Skip to content

Instantly share code, notes, and snippets.

@lava
Created January 17, 2020 09:49
Show Gist options
  • Select an option

  • Save lava/dc4740c4cfb45eb5703e6b579f2f60d8 to your computer and use it in GitHub Desktop.

Select an option

Save lava/dc4740c4cfb45eb5703e6b579f2f60d8 to your computer and use it in GitHub Desktop.

Revisions

  1. lava created this gist Jan 17, 2020.
    39 changes: 39 additions & 0 deletions git_merge_cheatsheet.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    # Git Merge Commit Cheatsheet

    Show contents of merge commits in `git log -p` output:

    git log -c


    Show changes to current branch in the last 24 hours:

    git rev-list --no-merges HEAD \
    --not $(git rev-list -n1 --before="24 hours" --first-parent HEAD)


    Default commit selection algorithm for `git log`:

    Commits are included if they are not TREESAME to any parent.
    If the commit was a merge, and it was TREESAME to one
    parent, follow only that parent. (Even if there are several
    TREESAME parents, follow only one of them.) Otherwise, follow
    all parents.


    Ordering algorithms for `git log`:

    * Reverse chronological order of commit timestamps, with no parent/child constraints. [default]

    * --[author-]date-order
    Show no parents before all of its children are shown, but otherwise show commits in the
    commit [author] timestamp order.

    * --topo-order
    Show no parents before all of its children are shown, and avoid showing commits on
    multiple lines of history intermixed.


    Behaviour of '~N' operator:

    Follows the *first* parent N times. (I.e. it will skip whole branches by default.)
    One can use `git log --first-parent` to see the target list of '~'.