Skip to content

Instantly share code, notes, and snippets.

@tylorr
Last active January 2, 2016 11:09
Show Gist options
  • Save tylorr/8294318 to your computer and use it in GitHub Desktop.
Save tylorr/8294318 to your computer and use it in GitHub Desktop.
Git aliases
[alias]
co = checkout
ci = commit
br = branch
st = status
ss = status -sb
au = add -u
aa = add -A
fe = fetch
rb = rebase
rbc = rebase --continue
k = "!gitk --all $* &"
pr = pull --rebase
prl = !sh -c 'git pr && git lag -5 ORIG_HEAD..FETCH_HEAD'
lg = log --oneline --decorate
lag = log --pretty=format:\"%C(cyan)%an%Creset %s %Cgreen(%cr)%Creset\"
# show logs since a commit
lgs = !sh -c 'git lg $1..HEAD' -
# shows diff of files and there status
df = diff --name-status
dw = diff --word-diff
# list all files that have changed between provided commit and HEAD e.g. git since v2.1
since = "!f() { git df $1 HEAD; }; f"
wdiff = diff --word-diff=color --unified=1
fixup = commit --fixup
squash = rebase -i --autostash --autosquash
sha = show --pretty=format:"%H" -q
inject = "!f() { set -e; SHA=$(git sha $1); shift; git fixup $SHA $*; git squash $SHA~; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment