Feb
6
2016
Git porcelain has improved a lot, it still has a couple of rough spots. Here are a couple of git aliases that make my git workflow more pleasant:
-
Dealing with aliases
1
2
3
4
5git config --global --add alias.add-alias \
'!f() { git config --global --add alias.$1 "$2"; }; f'
git add-alias aliases 'config --get-regexp ^alias'
git config --global --add alias.rm-alias \
'!f() { git config --global --unset alias.$1 ; }; f' -
Basic shortcuts
1
2
3
4
5
6
7
8
9git add-alias stat status
git add-alias co checkout
git add-alias ci commit
git add-alias br branch
git add-alias fa 'fetch --all'
git add-alias pullff 'pull --ff-only'
git add-alias pullrb 'pull --rebase'
git add-alias rbi 'rebase -i'
git add-alias bi bisect -
Informational
1
2
3
4
5
6git add-alias root 'rev-parse --show-toplevel'
git add-alias wb 'rev-parse --abbrev-ref HEAD'
git add-alias desc 'describe --dirty --abbrev=40'
git add-alias bll 'branch -vv --list'
git add-alias where \
'! echo "* HEAD:" $(git desc); git bll $(git wb)' -
Branches
1
2
3
4git add-alias bup-om \
'branch --set-upstream-to origin/master'
git add-alias cob 'checkout -b'
git add-alias cot 'checkout -b -t' -
Fundamental settings
1
2
3
4
5git config --global --add push.default simple
git config --global --add core.ui true
git config --global --add core.whitespace \
trailing-space,space-before-tab,tab-in-indent
git config --global --add merge.conflictstyle diff3Of course you must set user.email and user.name. If signing of commits is desired then set user.signingKey.
Leave a Reply
You must be logged in to post a comment.