dotfiles/dot_gitconfig.tmpl

89 lines
3.2 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
# 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
# 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
# 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
pr = remote prune origin
# from pixelbeat
brdate = for-each-ref --sort=-committerdate --format='%(committerdate:iso8601) %(refname:short)' refs/heads/
st = stash list --date=local
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
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 = vim
[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 -}}
[http]
# proxy = http://host:port