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)
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.
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