Created
August 30, 2013 20:11
-
-
Save philz/6393825 to your computer and use it in GitHub Desktop.
git-above
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License: Public Domain | |
# | |
# Usage: git-above [ref] | |
# | |
# ref defaults to "origin/master" if not specified. | |
# | |
# Returns the commit directly after that commit. Useful for pushing | |
# the "bottom" of your stack of changes above master. | |
# | |
# Is there a better way? | |
# | |
$type git-above | |
git-above is a function | |
git-above () | |
{ | |
x=${1:-origin/master}; | |
git-rev-list --ancestry-path "$x"..HEAD --reverse | head -1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment