TL;DR
different ancestry, empty diff, different program. How to see what the differences are?
The answer to the question, I thought, should be: if they are identical, there are no differences.
What's been happening to me right now is that I have two different revisions that seem to have an empty diff.
> git diff --quiet a1e4 5010; echo $?
> 0
They have different commit hashes, the program they contain behaves differently, yet the diff
is empty. How is this possible?
Is there a more powerful diff
I'm not aware of that would show deeper differences?
Isn't the hash computed on content alone? Then why is the diff
not detecting anything?
Here is the diagram
* 551d4dc very merge
|\
| |
| * a1e4b09 wow!
| |\
| | |
| | * a337e3c so uninteresting
| | |\
| | | |
| * | | a9f878a many unimportant
| |/ /
| | |
| * | 6d08e83 such irrelevance
| | |
* | | 5010427 wow!
| |/
|/|
| |
* | 74ac627 many father
|/
|
* f0aa6af such grandpa
|
.
The content of the 2 commits is the same which means that behind the scenes git will use the same SHA-1 for the tree (pointer) but as hobbs explained above a commit SHA-1 is the checksum of the commit content.
Commit contains blob trees and more info.
The commit object itself is a simply a checksum (SHA-1) of the metadata including a tree object to the tree of the given commit.
The commit contains more information than the one contained in the image below like timestamp and more.
In order to understand what is stored inside a commit we need to understand what is a commit. A commit is metadata attached to content.
Every time you add files to git they are started to be tracked and named by the SHA-1 of the content. When you commit changes git create a tree object which points to the tree of the files being committed in this revision.
If no change was made the tree will point to the same tree as the previous commit. If there was a change there will be a new tree.
If you wish to view the content of the commit use the
git show
For example here is what it will look like with git show: