Skip to content

Instantly share code, notes, and snippets.

@cmattoon
Created September 28, 2017 03:34
Show Gist options
  • Save cmattoon/75f9a974e696ce9238d28430e2422981 to your computer and use it in GitHub Desktop.
Save cmattoon/75f9a974e696ce9238d28430e2422981 to your computer and use it in GitHub Desktop.
git-prev-next
#!/bin/bash
# Provides 'git-prev' and 'git-next' commands for git
# to facilitate browsing step-by-step
# Run "source git_move.sh" to activate commands
_git_next() {
git log --reverse --pretty=%H master | \
grep -A 1 $(git rev-parse HEAD) | \
tail -n1 | xargs git checkout
}
alias git-prev="git checkout HEAD^1"
alias git-next="_git_next"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment