dotfiles/dot_gitconfig.tmpl

155 lines
5.5 KiB
Cheetah

# This is Git's per-user configuration file.
[user]
# Please adapt and uncomment the following lines:
name = {{ .name }}
email = {{ .email }}
[alias]
graph = log --graph --pretty=format:'%Cred%h %Creset-%C(yellow)%d%Creset %s %Cgreen(%cd) %C(blue)<%an>%Creset' --abbrev-commit --date=relative -30
logshort = log --pretty=format:'%Cred%h %Cgreen[%cd]%C(yellow)%d%Creset %s %C(bold blue)<%an>%Creset' --date=short
showfull = show --format=fuller --name-only
# Some aliases inspired by https://github.com/jessarcher
a = add
aa = add --all
ap = add --patch
au = add --update
b = branch
ba = branch --all
bd = branch --delete
bD = branch --delete --force
bm = branch --move
bM = branch --move --force
c = commit
# ca = commit --amend
# I use --all more often than amend
ca = commit --all
ci = commit --interactive
cm = commit --message
cv = commit --verbose
# from https://dzone.com/articles/lesser-known-git-commands
commend = commit --amend --no-edit
d = diff
dc = diff --cached
ds = diff --staged
dw = diff --word-diff
stl = stash list --date=local
st = stash
stp = stash pop
# more aliases from https://stackoverflow.com/questions/2553786/how-do-i-alias-commands-in-git
bv = branch -a -vv
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]%Creset%Cgreen\\ (%cd)" --decorate --numstat --date=relative
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
lstat = log --name-status
# print 'log hints', if using commit messages like "(test): Adjusted test classes"
loghints = ! git log --oneline | awk -F '(' '/^.{8}\\(.*/ {print $2}' | awk -F ')' '{print $1}' | sort | uniq -c
# initial push
puu = push -u origin
# Short summary of commiters
summary = shortlog --summary --numbered --email
# https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
# list remote branches ordered by date
rr = for-each-ref --sort=-committerdate refs/remotes/ --count=20 --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# show tracked files
ls-tracked = ls-tree -r --name-only HEAD
# show number of commits per author
# https://stackoverflow.com/questions/9839083/git-number-of-commits-per-author-on-all-branches
stats = shortlog -s -n --all --no-merges
# show staged changes
diffc = diff --cached -w
diffw = diff -w
wdiff = diff --word-diff=color --unified=1
# show stats
stat = show --stat --format=fuller
sname = show --name-status
# from https://dzone.com/articles/lesser-known-git-commands
commend = commit --amend --no-edit
stashed = stash list --date=local
s = status --column --show-stash
ss = status -s --branch -uno
co = checkout
cob = checkout -b
pr = remote prune origin
# from pixelbeat
# brdate = for-each-ref --sort=-committerdate --format='%(committerdate:iso8601) %(refname:short)' refs/heads/
# Alternative version from
brdate = for-each-ref --sort=-committerdate refs/heads/ --format='%(HEAD) %(color:red)%(objectname:short)%(color:reset) - %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) - %(color:blue)<%(authorname)> %(color:green)(%(committerdate:relative))%(color:reset)'
# from https://stackoverflow.com/questions/2514172/listing-each-branch-and-its-last-revisions-date-in-git
branchinfo = for-each-ref --sort='-committerdate:iso8601' --format='%(committerdate:relative)|%(refname:short)|%(committername)' refs/remotes/
st = stash list --date=local
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ / | sort
d = diff -w
dc = diff -w --cached
# from https://www.toptal.com/developers/gitignore
# create .gitignore templates based on operationg systems, IDE, languages etc.
ignore = "!gi() { curl -sL https://www.toptal.com/developers/gitignore/api/$@ ;}; gi"
[core]
editor = {{ .vimexec }}
hooksPath = ~/.config/git-hooks
[push]
# default = matching
default = simple # safer option, push only current branch
[pull]
ff = only
{{ if eq .chezmoi.os "windows" -}}
[merge]
tool = p4merge
ff = false
[mergetool "p4merge"]
path = "C:\\Program Files\\Perforce\\p4merge.exe"
cmd = p4merge $BASE $LOCAL $REMOTE $MERGED
keepBackup = false
[difftool "p4merge"]
external = p4merge $LOCAL $REMOTE
[difftool "winmerge"]
cmd = "'c:/PortableApps/PortableApps/WinMergePortable/App/WinMerge/WinMergeU'" -e "$LOCAL" "$REMOTE"
{{ end -}}
{{ if eq .chezmoi.os "linux" -}}
# see https://stackoverflow.com/questions/34119866/setting-up-and-using-meld-as-your-git-difftool-and-mergetool
[merge]
tool = meld
[mergetool "meld"]
cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED"
# cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED"
{{ end -}}
[http]
# proxy = http://host:port
#
[init]
# Talisman Test
# templatedir = 'c:/cygwin64/home/sgaiselm/.git-template'
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f