Skip to content

Instantly share code, notes, and snippets.

@jgierer12
Last active February 9, 2017 16:42
Show Gist options
  • Save jgierer12/b97417b33e87c4437ab9760a6de0dcf6 to your computer and use it in GitHub Desktop.
Save jgierer12/b97417b33e87c4437ab9760a6de0dcf6 to your computer and use it in GitHub Desktop.
[core]
autocrlf = false
editor = subl --wait --new-window
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
required = true
[url "https://github.com/"]
insteadOf = gh:
[url "https://gist.github.com/"]
insteadOf = gist:
[url "https://bitbucket.org/"]
insteadOf = bb:
[color]
ui = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = red
[commit]
template = ~/.gitmessage
[alias]
# List aliases
la = "!git config -l | grep alias | cut -c 7-"
# Shortcuts
co = checkout
cob = checkout -b
m = checkout master
aa = add -A
ap = add -p
ci = commit -v
st = status -s
cl = clone
cp = cherry-pick
br = branch
diff = diff --word-diff
dc = diff --cached
# Reset shortcuts
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
# Stash shortcuts
sl = stash list
sa = stash apply
ss = stash save
# Update working directory
pu = !git fetch origin && git fetch upstream && git merge upstream/master
# Push everything to origin
po = push -u origin --all
# Undo the last commit
undo = reset HEAD~1 --mixed
# Amend to last commit, keep same message
amend = commit --amend -C HEAD
# List aliases from http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
# List short
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
# List long
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# List without colors
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
# List short with date
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
# List short with relative date
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
# Default list short
le = log --oneline --decorate
# List short with graph
lg = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --graph --all
# List all commits related to a file
filelog = log -u
fl = log -u
# Show modified files in last commit
dl = "!git ll -1"
# Show diff of last commit
dlc = diff --cached HEAD^
# Show modified files in given revision
lc = "!f() { git ll "$1"^.."$1"; }; f"
# Show diff of given revision
diffr = "!f() { git diff "$1"^.."$1"; }; f"
dr = "!f() { git diff "$1"^.."$1"; }; f"
# Find a file in the repo
f = "!git ls-files | grep -i"
# Show the last tag
lasttag = describe --tags --abbrev=0
lt = describe --tags --abbrev=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment