To be a little nitpicky, those are technically shell aliases to git, not actually git aliases.
However, the link you included shows how to use git aliases.
I'd actually recommend against making a ton of shell aliases as they don't possess the full power that doing real git aliases can provide.
You can also run into trouble if you try to combine shell scripts with git. If you use real git aliases, you can use the aliases, but if you use shell aliases, you cannot.
Instead, I just do this single shell alias: alias g=git
Then include all the git aliases you want in ~/.gitconfig.
To execute, you just do:
$ g st # same as git status, the shell maps g -> git and git maps st -> status
Here's a large chunk of my ~/.gitconfig:
[alias]
git = !exec git
f = !git fetch || echo "Gretchen, stop trying to make fetch happen\\!"
st = status --short --branch
n = number
# number, short
nu = number --column -s
# number, full status
ns = number --column
# number command, e.g. git number -c vim 1 # opens file 1 in vim!
nc = number -c
nvi = number -c vim
na = number add
si = status --ignored
ci = commit
co = checkout
br = branch
df = diff
dc = diff --cached
dn = diff --name-only
dw = diff --color-words
sq = merge --squash
cob = checkout -b
# quick add all and commit with message
cm = commit -a -m
ammend = commit --ammend
# safer than just doing git reset HEAD --hard. we can restore using git reflog
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
llog = log --oneline @{upstream}..HEAD
llp = log -p @{upstream}..HEAD
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# log tree
lt = log --graph --simplify-by-decoration --pretty=format:'%d' --all
# log list
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# longer log list
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# log list no color
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
# log oneline with dates
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# short git log
le = log --oneline --decorate
# quick good log
l = log --graph --oneline --decorate --date=relative --all
# filelog
filelog = log -u
fl = log -u
# diff last commit
dlc = diff --cached HEAD~1
pr = pull --rebase
pro = pull --rebase origin
prom = pull --rebase origin mainline
dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%ar%C(reset)%C(auto)%d%C(reset)%n%s' --date-order
dfn = diff --name-only
diffn = diff --name-only
permission-reset = !git diff -p -R | grep -E \"^(diff|(old|new) mode)\" | git apply
# searches through all commits
supergrep = !git rev-list --all | xargs git grep
fo = fetch origin
# show recent branches
recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"
scan = "!git clean -nx && git clean -ndx"
nuke = "!git clean -fx && git clean -fdx"
Thanks for the detailed explanation Valentin. I wanted to write a bash script for git aliases so that I could learn both bash and git. That was my requirement and I guess it is time to make the changes to the my little code snippet.
Dang. There is such a thing as too many Git aliases. Seems to me that after a certain point, unless you have them all memorized, you'd start running into diminishing returns.
To be a little nitpicky, those are technically shell aliases to git, not actually git aliases.
However, the link you included shows how to use git aliases.
I'd actually recommend against making a ton of shell aliases as they don't possess the full power that doing real git aliases can provide.
You can also run into trouble if you try to combine shell scripts with git. If you use real git aliases, you can use the aliases, but if you use shell aliases, you cannot.
Instead, I just do this single shell alias:
alias g=git
Then include all the git aliases you want in ~/.gitconfig.
To execute, you just do:
Here's a large chunk of my ~/.gitconfig:
Thanks for the detailed explanation Valentin. I wanted to write a bash script for git aliases so that I could learn both bash and git. That was my requirement and I guess it is time to make the changes to the my little code snippet.
Thanks for the clarifying comment.
Dang. There is such a thing as too many Git aliases. Seems to me that after a certain point, unless you have them all memorized, you'd start running into diminishing returns.
I don't use all of them and by no means have them all memorized.
For the most part, they're just acronyms: 'dw' == 'diff words'.
I also kind of use my git alias file as place to keep notes for commands.
You should see my shell alias file :P I like to joke that I hate typing.
I'm stealing this