You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
add flag --first-parent only display first parent of merge commits #137
In a typical GitHub workflow, there is a main with short-lived feature or bugfix branches that are merged to the main branch.
git log has a --first-parent option that allow to hide all the commits in the temporary branches and only display the merge commits of the main branch. It can greatly simplify the reading the git history, since only the non-merged branches appear (either long-lived branches or not-yet-merged branches).
I believe GitLab is doing the same for their git log, hiding commits in forks and in temporary branches.
Here's a screenshot the Git Graph extension for Visual Studio Code that implements this option pretty nicely (blue is main, pink is a release branch):
without --first-parent on the left
without --first-parent on the right
(note: the colors between left and right don't necessary refer to the same branches)
This is a great feature, although the name is somewhat misleading. Maybe --follow-first-parent-only .. hm, a little long. A little shorter: --hide-merged-branches. Suggestions are welcome
There is a backside, that should be mentioned somewhere. if all branches have been merged, it looks as if none ever happened. Do you want this to apply to all branches, or only the one you pick (eg. main)?
--first-parent was mentioned for behavior reference, but I agree this is not a great name.
To me the way git-log or Git Graph extension displays it is perfect.
To address your concern, I believe git-graph should keep the specific icon for merge commits even when hiding merged branch. This way, users would still be able to differentiate different types of commits (which Git Graph extension doesn't have unfortunately) and have information about where merges happen (at least the last one that impacts their branch).
As a side note, there are some comments where this option doesn't apply to all git workflow because people sometimes have weird branch management. So it's probably a good idea to still mention --first-parent in the help or documentation, unless of course if you want to come up with a different implementation.
Activity
peso commentedon Jan 16, 2026
This is a great feature, although the name is somewhat misleading. Maybe
--follow-first-parent-only.. hm, a little long. A little shorter:--hide-merged-branches. Suggestions are welcomeThere is a backside, that should be mentioned somewhere. if all branches have been merged, it looks as if none ever happened. Do you want this to apply to all branches, or only the one you pick (eg.
main)?pinage404 commentedon Jan 17, 2026
I suggest
--no-mergedlikegit branch --no-mergedvincent-chtln commentedon Jan 19, 2026
--first-parentwas mentioned for behavior reference, but I agree this is not a great name.To me the way
git-logorGit Graphextension displays it is perfect.To address your concern, I believe
git-graphshould keep the specific icon for merge commits even when hiding merged branch. This way, users would still be able to differentiate different types of commits (whichGit Graphextension doesn't have unfortunately) and have information about where merges happen (at least the last one that impacts their branch).As a side note, there are some comments where this option doesn't apply to all git workflow because people sometimes have weird branch management. So it's probably a good idea to still mention
--first-parentin the help or documentation, unless of course if you want to come up with a different implementation.