Skip to content

add flag --first-parent only display first parent of merge commits #137

@vincent-chtln

Description

@vincent-chtln

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)

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions