-
Notifications
You must be signed in to change notification settings - Fork 2
/
gitconfig
60 lines (59 loc) · 2.2 KB
/
gitconfig
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 = [email protected]
[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 +/- character
# 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|main)$' | xargs git branch --delete"
sync = "!(git checkout master 2> /dev/null || git checkout main 2> /dev/null) && 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