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:
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-pathwhich can be used to show only the direct ancestry path:git log --ancestry-path commit1..commit2.gitkgenerally takes the same commit specification options asgit-log, which inherits them in turn fromgit-rev-list.