I'm curious if there is a way to show branch hierarchy on the command line? For instance if I use git branch
, instead of seeing output like this:
* master joes_work refactoring experiment
You see output like this:
* master joes_work refactoring experiment
That way it's easy to see which branch a particular branch.. branched off of. Even if there's no specific command that outputs a tree structure, is there a command that outputs information on which branch came from which branch? I can use a perl script to format the output.
Click the File menu, point to Source Control, point to Branching and Merging, and then click View Hierarchy.
To see local branches, use the git branch command. The git branch command lets you see a list of all the branches stored in your local version of a repository.
sehe's solution looks great, here is another one that seems to contain similar information, formatted differently, it uses git log, so it contains commit information as well (ignore the branch names, I kind of messed them up!):
git log --all --graph --decorate --oneline --simplify-by-decoration * ae038ad (HEAD, branch2-1) add content to tmp1 | * f5a0029 (branch2-1-1) Add another |/ * 3e56666 (branch1) Second wave of commits | * 6c9af2a (branch1-2) add thing |/ * bfcf30a (master) commit 1
Try
git show-branch git show-branch --all
Example output:
bash$ git show-branch --all ! [branchA] commitA only in branchA * [branchB] commitB ! [branchC] commitC only in branchC --------------------- + [branchA] commitA only in branchA * [branchB] commitB + [branchC] commitC only in branchC *+ [branchC~1] commitB-1 also in branchC *+ [branchC~2] commitB-2 also in branchC +++ [branchC~3] common ancestor +++ [branchC~4] more common ancestors
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With