Skip to content

Instantly share code, notes, and snippets.

@maximkott
Created November 17, 2015 14:46
Show Gist options
  • Save maximkott/12a8165d8b70fb95cd50 to your computer and use it in GitHub Desktop.
Save maximkott/12a8165d8b70fb95cd50 to your computer and use it in GitHub Desktop.
Moving back and forth between git commits.
function n() {
git log --reverse --pretty=%H master | grep -A 1 $(git rev-parse HEAD) | tail -n1 | xargs git checkout
}
function p() {
git checkout HEAD^1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment