aboutsummaryrefslogtreecommitdiffstats
path: root/gitconfig
blob: 83ca48310157b835322b312710ac12734a9df749 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- mode: conf-unix; indent-tabs-mode: t -*-

[user]
	name = Martin Polden
	email = mpolden@mpolden.no
[core]
	attributesfile = ~/.gitattributes
	excludesfile = ~/.gitignore
	autocrlf = input
	# This pager removes leading +/- from colored unified diff
	# Matching:
	# 1. Color escape characters
	# 2. Any leading spaces
	# 3. Any leading +/- characters
	# Substitution:
	# 1. Put back escape characters
	# 2. Put back spaces
	# 3. Replace any matched +/- with the same number of spaces in reversed
	# color, to preserve indentation and highlighting of empty lines
	pager = perl -pe \"s|^(\\e\\[\\d{2,}m)(\\s*)([-+]+)|\\\"\\$1\\$2\\e[7m\\\" . (' ' x length(\\$3)) . \\\"\\e[27m\\\"|e\" | $PAGER
[pager]
	# Disable pager for branch and tag. This restores < 2.15.0 behaviour
	branch = cat
	tag = cat
[color]
	ui = auto
[alias]
	lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
	fzf = "!git lg --no-graph --color=always | fzf --ansi --multi --reverse --no-sort --delimiter=' - ' --nth=2.. --preview='git show --color=always {1}' | cut -f 1 -d ' '"
	s = status --short --branch
	co = checkout
	b = branch
	prune-branches = "!git branch --merged | grep -Ev '^\\*|  master$' | xargs git branch --delete"
	sync = "!git checkout master && git pull && git prune-branches"
	sync-here = "!git fetch origin master:master && git prune-branches"
	wip = "!git add --all && git commit -m wip"
	wip-reset = "!git show --no-patch --format=%s HEAD | grep -qE '^wip$' && git reset --soft HEAD~1 || echo 'no wip commit found' 1>&2"
	latest-tag = "!git tag -l 'v[0-9]*' | sort -rV | head -1"
	# Clean, but preserve IntelliJ config and Maven build output that appear in
	# directories which are otherwise still tracked in git
	clean-java = "!git clean -ndx | sed 's/^Would remove //' | grep -vE '(\\.iml|\\.idea/|/target/)$' | tr '\\n' '\\0' | xargs -r0 git clean -dx"
[push]
	default = simple
[fetch]
	prune = true
[branch]
	autosetuprebase = always
[rebase]
	stat = true
	autostash = true
[grep]
	lineNumber = true
[log]
	follow = true
[diff]
	indentHeuristic = true
[include]
	path = .gitconfig.local
[init]
	defaultBranch = master