Reputation: 13588
If I look at the commit graph with gitk --all
, it's quite complicated (I did a lot of branching and merging just for the fun of it on a little one person project). Now I was wondering, if there is a way to simplify this graph?
Simplify in the sense of removing unnecessary branching (the branches are all merged into master at some point)
Upvotes: 3
Views: 1633
Reputation: 12940
When you want to take a look of entire history, --all could be too much. Here is some options that could give you a hand of what's cooking on a repo:
git --simplify-by-decoration --all
gitk --simplify-by-decoration --all
It will show all commits "marked" with a ref or tag, included those not marked needed to understand ancestry (pretty useful). See git log history simplification
Answering your exact questions you can use:
git --simplify-merges --all
gitk --simplify-merges --all
but that is included on --simplify-by-decoration
I make a lot use of that (on command line) so I use an alias:
git config --global alias.logs 'log --simplify-by-decoration --graph --color --oneline --decorate'
To use it:
git logs --all
git logs master..development
Upvotes: 1
Reputation: 496912
I'm fairly certain that what you're looking for is the first parent option, which causes Git to walk to only the first parent of merge commits as it traverses the history. You can use it from the command line:
git log --first-parent
gitk --first-parent
or within gitk: View > New view... > Limit to first parent (under Miscellaneous).
Of course, you might also not want to use --all
; gitk <commit>...
shows only the history starting from the given commits (which could be specified as branches), and with no arguments it defaults to the current branch.
If you have a more precise idea about the history you want to see, you could use some of the other options listed under History Simplification in man git-log
. Notably there's --ancestry-path
which can be used to show only the direct ancestry path: git log --ancestry-path commit1..commit2
. gitk
generally takes the same commit specification options as git-log
, which inherits them in turn from git-rev-list
.
Upvotes: 3