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
git get-merge is a git command to locate the merge that introduced a
given commit into a given branch in your repository (master by default). It
is correct with very high probability.
> git get-merge help
usage: git get-merge <sha> [branch]
Attempt to find when commit <sha> was merged to <branch>, where <branch> is
`master` by default. Two methods are used:
# method 1
Stupid algorithm which works most of the time.
Follow the commit downstream and return the first merge into another
branch, as opposed to a merge from another branch. Hopefully, this other
branch is <branch>.
Abort if the graph starts branching or terminates.
# method 2
Find the earliest common commit between ancestry-path and first-parent.
Source: https://stackoverflow.com/a/8492711
This is the correct algorithm assuming a properly-maintained git
history. However, if there has ever been a fast-forward merge of a feature
branch into <branch>, the first-parent history of <branch> will have been
tampered with and this "correct" approach could fail.
About
A git command to find the merge that introduced a given commit.