Skip to content

Instantly share code, notes, and snippets.

@kljohann
Created February 21, 2018 19:58
Show Gist options
  • Save kljohann/5cd9dbabd92ad96f9ee293432806c93e to your computer and use it in GitHub Desktop.
Save kljohann/5cd9dbabd92ad96f9ee293432806c93e to your computer and use it in GitHub Desktop.
[core]
excludesfile = ~/.gitignore
whitespace = trailing-space,space-before-tab
[color]
ui = auto
[push]
default = upstream
[help]
autocorrect = 60
[diff]
renames = yes
mnemonicprefix = yes
algorithm = patience # histogram, minimal
tool = vimdiff
guitool = meld
[merge]
tool = vimdiff
conflictstyle = diff3
[alias]
sclone = clone --depth=1 --shallow-submodules
each = "!f () { find . -name .git -type d -prune -printf \"\\n%h\\n\" -exec git -C {}/.. \"$@\" \\; ; }; f"
all-files-ever = ! git log --format=format: --name-only --diff-filter=A | sort -u - | tail -n +2
ff = merge --ff-only
cdiff = diff --cached
d = diff --color --color-words --abbrev --patch-with-stat
c = diff --color --color-words --abbrev --patch-with-stat --cached
s = status --short --branch
su = status --short --branch --untracked-files=no
ls = log --graph --decorate --pretty=short --abbrev-commit
l = log --graph --decorate --pretty=oneline --abbrev-commit
la = log --graph --decorate --pretty=oneline --abbrev-commit --all
ll = "!f () { git log --pretty=format:'%H%x00%an%x00%ar%x00%s%x00%d' $@ | awk -F '\\0' '{ printf \"\\033[33m%-8.8s \\033[35m%-6.6s \\033[32m%-12.12s \\033[0m%-60.60s \\033[34m%-40.40s \\n\", $1, $2, $3, $4, $5 }' | less -R; }; f"
llg = "!f () { git log --graph --color=always --pretty=format:'%x00%H%x00%s%x00%ar%x00%an%x00%d' $@ | awk -F '\\0' '{ printf \" \\033[33m%-8.8s \\033[0m%-60.60s \\033[32m%-12.12s \\033[35m%-6.6s \\033[0m%s\\033[34m%-30.30s \\n\", $2, $3, $4, $5, $1, $6 }' | less -R; }; f"
tt = !tig --all
tn = "!f () { tig $1@{1}..$1@{0}; }; f"
tnu = !tig @{u}@{1}..@{u}@{0}
co = checkout
unstage = reset HEAD --
stash-unapply = !git stash show -p | git apply -R
stashp = stash save -p
fixup = commit --fixup
squash = commit -c --squash
ri = rebase --interactive --autosquash
whatsnew = "!f () { git log $1@{1}..$1@{0}; }; f"
alias = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/\t = /' | sort
todo = grep --line-number --context 2 --heading --break -E '(TODO|FIXME|XXX|HACK|OPTIMIZE|WTF)'
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment