Created
September 13, 2014 19:36
-
-
Save ParkinT/205e8ee5761431192509 to your computer and use it in GitHub Desktop.
A list of example git alias shortcuts from the "Mastering Git" [ISBN 978-1-78355-413-3] book by Packt Publishing. This is described in Section 7.
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
### Common Commands | |
ssb = status -sb | |
logo = log --oneline | |
c = commit -m | |
a = add | |
cob = checkout -b | |
st = status -s | |
co = checkout | |
stat = status | |
cl = clone | |
ci = commit | |
co = checkout | |
br = branch | |
### Diff | |
diff = diff --word-diff | |
dc = diff --cached | |
### Log | |
who = shortlog -n -s --no-merges #to see who has contributed to the project | |
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short | |
## File Inspection | |
type = cat-file -t | |
dump = cat-file -p | |
### Oops | |
undo = reset --hard HEAD~1 | |
## Pretty Print | |
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate | |
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short | |
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
l = log --graph --pretty=format:'%C(yellow)%h%C(cyan)%d%Creset %s %C(white)- %an, %ar%Creset' | |
## Stash Shortcuts | |
sl = stash list | |
sa = stash apply | |
ss = stash save | |
## Find a filepath in the codebase | |
f = !git ls-files | grep -i | |
oneweek = log --format="%H" --since="1 week ago" --reverse | xargs -L 1 git show | |
fivedays = log --format="%H" --since="5 days ago" --reverse | xargs -L 1 git show | |
fourdays = log --format="%H" --since="4 days ago" --reverse | xargs -L 1 git show | |
## Special thanks to Harold Giménez | |
cleanup = !git remote prune origin && git gc && git clean -dfx && git stash clear | |
## List all aliases | |
aliases = !git config -l | grep alias | cut -c 7- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment