Hi everyone!

I've been using Git heavily for about 7 years. A few days ago I found a 
behavior that surprised me. I found `git log`, `git blame` and `git bisect` 
to exhibit this weird behavior. [A friend][1] let me know about the 
`--full-history` flag to `git log` that solved my problem, and another 
person showed me that `--full-history` works for `git blame` too . I want 
to know, for my own education, whether there is an equivalent fix for `git 
bisect`.


Feel free to see the problem for yourself with this repo: 
https://dl.dropboxusercontent.com/u/1927707/problematic_repo.7z

Here is its log:

    $ git log  --graph
    * commit b7a8d7aa001d06eb7491ab5fb447a8dd3aa421a8
    | Author: Ram Rachum <r...@rachum.com>
    | Date:   Tue Apr 19 17:45:01 2016 +0300
    |
    |     adding more to some-file
    |
    *   commit 0aa833916e908ea93902a6c4c227f9a884a1bcef
    |\  Merge: 2413945 3068c7d
    | | Author: Ram Rachum <r...@rachum.com>
    | | Date:   Tue Apr 19 17:44:31 2016 +0300
    | |
    | |     Merge branch 'master' into development
    | |
    | * commit 3068c7d2548f1798b6840f73b13a649937339f28
    | | Author: Ram Rachum <r...@rachum.com>
    | | Date:   Tue Apr 19 16:02:27 2016 +0300
    | |
    | |     Adding sugar to coffee
    | |
    * | commit 24139451ab954b1f0a9ef616775a3dba0ac81669
    |/  Author: Ram Rachum <r...@rachum.com>
    |   Date:   Tue Apr 19 16:01:28 2016 +0300
    |
    |       Creating some-file
    |
    * commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661
      Author: Ram Rachum <r...@rachum.com>
      Date:   Tue Apr 19 16:00:47 2016 +0300
    
          Create coffee

In the very first commit, the file `coffee` was added. In the commit 
`3068c7d`, I added a line "sugar" to the `coffee` file. But then I merged 
this branch into the `development` branch, and in that merge, a mistake was 
made and the "sugar" line was removed, leaving `coffee` empty. Then another 
commit `b7a8d7a`, making an unrelated change, was added for good measure. 

Now I'm looking at my coffee, and finding there's no sugar in it. I 
distinctly remember adding sugar to my coffee. I run `git log coffee`, and 
get this output:

    $ git log coffee
    commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661
    Author: Ram Rachum <r...@rachum.com>
    Date:   Tue Apr 19 16:00:47 2016 +0300
    
        Create coffee

That's it. `git log` is showing neither my original commit that added the 
sugar, nor the merge that removed it. Two very relevant commits that are 
missing. 

I was frustrated for about an hour by this problem, because it happened in 
a huge enterprise repo, where commits are much harder to find manually.

I also tried using `git bisect` to pin down the two commits, but it pointed 
me to the wrong commit after I finished doing all the `git bisect bad` and 
`git bisect good` actions.

Then, as I said in the beginning, a friend pointed me towards the 
`--full-history` flag:

    $ git log --full-history --graph coffee                
    *   commit 0aa833916e908ea93902a6c4c227f9a884a1bcef    
    |\  Merge: cf02fbb 3068c7d                             
    | | Author: Ram Rachum <r...@rachum.com>                
    | | Date:   Tue Apr 19 17:44:31 2016 +0300             
    | |                                                    
    | |     Merge branch 'master' into development         
    | |                                                    
    | * commit 3068c7d2548f1798b6840f73b13a649937339f28    
    |/  Author: Ram Rachum <r...@rachum.com>                
    |   Date:   Tue Apr 19 16:02:27 2016 +0300             
    |                                                      
    |       Adding sugar to coffee                         
    |                                                      
    * commit cf02fbbc40104cd02eea4c7c6f134ef1fd7b5661      
      Author: Ram Rachum <r...@rachum.com>                  
      Date:   Tue Apr 19 16:00:47 2016 +0300               
                                                           
          Create coffee                                    

This makes me happy because it shows the two relevant commits, the one 
adding sugar and the merge that removed it. So my problem is solved. **But 
I really wish I could know how to make `git bisect` as well.** Does anyone 
happen to know?


  [1]: http://www.syntevo.com/smartgithg/

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to