Skip to content

Instantly share code, notes, and snippets.

@avanslaars
Created November 6, 2015 20:27
Show Gist options
  • Save avanslaars/5726fb8835a5a564ddf5 to your computer and use it in GitHub Desktop.
Save avanslaars/5726fb8835a5a564ddf5 to your computer and use it in GitHub Desktop.
Bash functions for stepping forward and backward through git commits.
git_next() {
BRANCH=$1
git checkout `git log --reverse --ancestry-path HEAD..${BRANCH:="master"} | head -n 1 | cut -d \ -f 2`
}
git_prev(){
git checkout HEAD^
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment