I have been using Git for about 7 years. A few days ago I found behavior that surprised me. I found git log , git blame and git bisect to show this strange behavior. Friend tell me about the --full-history sign on git log , which solved my problem. I want to know, for my own education, is there an equivalent fix for git blame and git bisect .
Feel free to see a problem with this repo: https://dl.dropboxusercontent.com/u/1927707/problematic_repo.7z
Here is his journal:
$ git log --graph * commit b7a8d7aa001d06eb7491ab5fb447a8dd3aa421a8 | Author: Ram Rachum < ram@rachum.com > | Date: Tue Apr 19 17:45:01 2016 +0300 | | adding more to some-file | * commit 0aa833916e908ea93902a6c4c227f9a884a1bcef |\ Merge: 2413945 3068c7d | | Author: Ram Rachum < ram@rachum.com > | | Date: Tue Apr 19 17:44:31 2016 +0300 | | | | Merge branch 'master' into development | | | * commit 3068c7d2548f1798b6840f73b13a649937339f28 | | Author: Ram Rachum < ram@rachum.com > | | Date: Tue Apr 19 16:02:27 2016 +0300 | | | | Adding sugar to coffee | | * | commit 24139451ab954b1f0a9ef616775a3dba0ac81669 |/ Author: Ram Rachum < ram@rachum.com > | Date: Tue Apr 19 16:01:28 2016 +0300 | | Creating some-file | * commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661 Author: Ram Rachum < ram@rachum.com > Date: Tue Apr 19 16:00:47 2016 +0300 Create coffee
In the very first commit, the coffee file is added. In commit 3068c7d I added the string "sugar" to the coffee file. But then I merged this branch into the development branch, and an error was made in this merge, and the string βsugarβ was deleted, leaving coffee empty. Then another b7a8d7a commit was b7a8d7a , creating an unrelated change.
Now I look at my coffee and donβt see sugar there. I clearly remember adding sugar to my coffee. I run git log coffee and get this output:
$ git log coffee commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661 Author: Ram Rachum < ram@rachum.com > Date: Tue Apr 19 16:00:47 2016 +0300 Create coffee
What is it. git log shows neither my original agreement, which added sugar, nor the merger, which removed it. Two very important commits that are missing.
I was upset about an hour by this problem because it happened on a huge corporate repo where teams are much more difficult to find manually.
I also tried using git bisect and git blame to commit two commits, but both of these tools ignored the two commits. git bisect pointed me to a wrong commit after I finished doing all the git bisect bad and git bisect good actions.
Then, as I said at the beginning, a friend pointed me to the --full-history flag:
$ git log --full-history --graph coffee * commit 0aa833916e908ea93902a6c4c227f9a884a1bcef |\ Merge: cf02fbb 3068c7d | | Author: Ram Rachum < ram@rachum.com > | | Date: Tue Apr 19 17:44:31 2016 +0300 | | | | Merge branch 'master' into development | | | * commit 3068c7d2548f1798b6840f73b13a649937339f28 |/ Author: Ram Rachum < ram@rachum.com > | Date: Tue Apr 19 16:02:27 2016 +0300 | | Adding sugar to coffee | * commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661 Author: Ram Rachum < ram@rachum.com > Date: Tue Apr 19 16:00:47 2016 +0300 Create coffee
This makes me happy because it shows two matching commits: one adds sugar and the merge that removes it. Therefore, my problem is resolved. But I would love to know how to behave git bisect and git blame . Somebody knows?