Changes

Jump to navigation Jump to search
94 bytes added ,  15:46, 17 March 2021
add ref
<br />
== How did I get here? ==
What branch did this branch originate from? Or more precisely, what's the nearest ancestor commit on a separate branch?<syntaxhighlight lang="bash" line="1">
branch=`git rev-parse --abbrev-ref HEAD` \
</syntaxhighlight>Explanation:
# Grab the name of the current branch.# Show all commits (with errors or warnings going to dev null).# Ancestors of the current commit are indicated by a star. Filter out everything else.# Ignore all the commits in the current branch.# The first commit remaining is the nearest ancestor from another branch.# Branch names are displayed [in brackets]. Ignore the brackets and everything else.# Sometimes the branch name will include a ~2 or ^1 to indicate how many commits are between the referenced commit and the branch tip. We don't care. Ignore them. <ref>https://stackoverflow.com/questions/3161204/how-to-find-the-nearest-parent-of-a-git-branch</ref>
==Don't merge, Rebase!==

Navigation menu