Last active
November 8, 2023 17:08
-
-
Save thegeorgenikhil/7f82418d29cf654358019d8b167b4651 to your computer and use it in GitHub Desktop.
Move between commits - Helpful while exploring new codebases!
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
# Move backward one commit back | |
alias gitbwd='git log --all --decorate --oneline | grep -A 1 $(git rev-parse --short HEAD) | awk "{print \$1}" | tail -1 | xargs -I {} git checkout {}' | |
# Move forward one commit up | |
alias gitfwd='git log --all --decorate --oneline | grep -B 1 $(git rev-parse --short HEAD) | awk "{print \$1}" | head -1 | xargs -I {} git checkout {}' | |
# See the files names that got changed between the commit | |
alias cdiff='git diff --name-only HEAD~1 HEAD' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment