Skip to content

Instantly share code, notes, and snippets.

@camilleriluke
Last active February 14, 2019 12:55
Show Gist options
  • Save camilleriluke/22af8f3e3069368ca857d58705a8ea7d to your computer and use it in GitHub Desktop.
Save camilleriluke/22af8f3e3069368ca857d58705a8ea7d to your computer and use it in GitHub Desktop.
gitconfig primer
[core]
excludesfile = /Users/CHANGE_HERE/.gitignore_global
pager = diff-so-fancy | less -r
editor = code -w
[user]
name = YOUR_NAME
useConfigOnly = true
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
ignore-file = !git update-index --assume-unchanged
unignore = !git update-index --no-assume-unchanged
ignored = !git ls-files -v | grep ^[a-z]
co = checkout
s = status
b = !git branch -vv $@ | xargs -0 echo
d = diff
ds = diff --staged
unstage = reset HEAD
c = cz
f = fetch -p
mm = merge master
fm = fetch origin master:master
r2 = !git rebase -i HEAD~2
gone = !git b | grep ': gone]'
ahead = !git b | grep ahead
ap = !git add --patch
changed-files = !git diff --name-only $(git rev-parse --abbrev-ref HEAD) $(git merge-base $(git rev-parse --abbrev-ref HEAD) master)
tidy = "! f() { remote_branch=`git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null`; if [[ -z $remote_branch ]] ; then echo 'There is no upstream branch set.' ; else git rebase -i $remote_branch; fi ; } ; f "
merged-branches = !git branch -vv -r --merged | grep origin | grep -v '>' | grep -v master
delete-gone = !git branch -vv --color=never | grep ': gone]' | grep -v '>' | xargs -L1 | awk '{print($1)}' | xargs git b -d
delete-gone-force = !git branch -vv --color=never | grep ': gone]' | grep -v '>' | xargs -L1 | awk '{print($1)}' | xargs git b -D
po = !git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
ss = ci-status
cpr = compare
prl = pr list --format='%sC%>(8)%i%Creset %Cyellow%<(12)@%au%Creset %Cgreen%U%Creset %t %l %n'
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[color]
ui = always
[color "branch"]
current = red reverse
local = yellow
remote = green
upstream = blue bold
[color "diff"]
meta = yellow bold
commit = green bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
# Git integrity - https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0
[transfer]
fsckobjects = true
[fetch]
fsckobjects = true
[receive]
fsckObjects = true
[push]
default = simple
[commit]
verbose = true
[credential]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment