|
|
Line 137: |
Line 137: |
| <br /> | | <br /> |
|
| |
|
| == How did I get here? == | | ==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"> | | 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` \ | | branch=`git rev-parse --abbrev-ref HEAD` \ |
Line 148: |
Line 148: |
| </syntaxhighlight>Explanation: | | </syntaxhighlight>Explanation: |
|
| |
|
| # Grab the name of the current branch. | | #Grab the name of the current branch. |
| # Show all commits (with errors or warnings going to dev null). | | #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. | | #Ancestors of the current commit are indicated by a star. Filter out everything else. |
| # Ignore all the commits in the current branch. | | #Ignore all the commits in the current branch. |
| # The first commit remaining is the nearest ancestor from another branch. | | #The first commit remaining is the nearest ancestor from another branch. |
| # Branch names are displayed [in brackets]. Ignore the brackets and everything else. | | #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. | | #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!== | | ==Don't merge, Rebase!== |