Created
July 9, 2015 08:49
-
-
Save chanwit/63a67063f90080c46c6d to your computer and use it in GitHub Desktop.
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
# checkout prev (older) revision | |
git_prev() { | |
git checkout HEAD~ | |
} | |
# checkout next (newer) commit | |
git_next() { | |
BRANCH=`git show-ref | grep $(git show-ref -s -- HEAD) | sed 's|.*/\(.*\)|\1|' | grep -v HEAD | sort | uniq` | |
HASH=`git rev-parse $BRANCH` | |
PREV=`git rev-list --topo-order HEAD..$HASH | tail -1` | |
git checkout $PREV | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment