Skip to content

Instantly share code, notes, and snippets.

@alexey-bass
Last active August 18, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexey-bass/4056358 to your computer and use it in GitHub Desktop.
Save alexey-bass/4056358 to your computer and use it in GitHub Desktop.
Collection of my Git aliases. Put in ~/.gitconfig
# First time setup - https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
# Line endings - https://help.github.com/en/articles/dealing-with-line-endings
# Learn branching - http://pcottle.github.com/learnGitBranching/
[user]
name = Alexey Bass
email = alexey.bass@liamg.moc
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
upstream = red
[color "log"]
upstream = red
[push]
default = current
[alias]
a = add
aa = add --all
b = branch -vv
ba = branch -a -vv
bd = branch -d
bs = !git-branch-status
bsi = !git-branch-status -i
c = commit
cm = commit -m
cam = commit --all -m
co = checkout
cob = checkout -b
com = checkout master
cod = checkout develop
d = diff
# d = diff --ignore-space-at-eol -b -w --ignore-blank-lines
dc = diff --cached
ds = diff --shortstat
dss = diff --stat
dsp = diff --stat -p
# files changed between commits
dn = diff --name-only
f = !git fetch && git lg
ff = !git f && echo && git ln --oneline HEAD..origin/HEAD
# file history (log)
fh = log -p
h = help
l = log --decorate
ls = log --stat --decorate
ln = log --name-status
lsp = log --stat -p --decorate
# use 'git lg -10' to limit output
lg = log --graph '--pretty=tformat:%h %Cgreen%ar (%an)%Creset %Cred%d%Creset %s'
lga = log --graph '--pretty=tformat:%h %Cgreen%ar (%an)%Creset %Cred%d%Creset %s' --all
# for complicated branches
lsd = log --graph '--pretty=tformat:%h %Cgreen%ar (%an)%Creset %Cred%d%Creset %s' --simplify-by-decoration
lsda = log --graph '--pretty=tformat:%h %Cgreen%ar (%an)%Creset %Cred%d%Creset %s' --all --simplify-by-decoration
ls-del = ls-files -d
ls-mod = ls-files -m # including remote files
ls-new = ls-files --exclude-standard -o
ls-ign = ls-files --exclude-standard -o -i
ru = remote update
sb = show-branch --sha1-name
s = status --short
ss = status
# "git s ." or "git ss ." will show only relative status
st = stash
stl = stash list
stp = stash pop
# drop is critical, type it full
# wget http://git-wt-commit.rubyforge.org/git-wtf
# sudo ln -s ~/git-wtf /usr/bin/git-wtf; chmod a+x ~/git-wtf
wtf = wtf -r -A
stats = shortlog --summary --numbered --no-merges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment