tags:

views:

24

answers:

1

I can't figure out why git show-branch isn't giving me the same full history that git log --graph shows me. Why would the following discrepancy occur?

$ git log --graph --oneline --date-order
*   786c9bd Merge branch 'master' into testbr
|\  
* | dda9989 ch2 to couch
* | 05d0851 chg 1 to couch
| * 3df86c2 change 1 to tv
| * 900ad58 added tv
|/  
* 76352a8 mess
$ git show-branch
! [master] change 1 to tv
 * [testbr] Merge branch 'master' into testbr
--
 - [testbr] Merge branch 'master' into testbr
+* [master] change 1 to tv

Further, if I create a new branch (see below), then git show-branch gives the output I expect.

$ git branch foo testbr~3
$ git show-branch
! [foo] mess
 ! [master] change 1 to tv
  * [testbr] Merge branch 'master' into testbr
---
  - [testbr] Merge branch 'master' into testbr
 +* [master] change 1 to tv
 +* [master^] added tv
  * [testbr^] ch2 to couch
  * [testbr~2] chg 1 to couch
++* [foo] mess
A: 

Compared to git log, git show-branch only shows:

  • branches (HEAD that is '*' and non-HEAD: '!' which have a relation with HEAD)
  • commits from branches linked to HEAD (below the '--'):
    • '*' commits from HEAD branch
    • '+' commits from non-HEAD branches
    • '*+' commits from non-HEAD branches also part of HEAD branch
    • '-' merge commits

and their commits), not all commits.

The fact that your second example looks like the initial git log only means that those commits displayed in the second show-branch are linked to the HEAD branch, making them close of a classic commit graph (which git log produces)

VonC