-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgitconfig
More file actions
77 lines (76 loc) · 2.61 KB
/
gitconfig
File metadata and controls
77 lines (76 loc) · 2.61 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- 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 +/- 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\\[.{,2}\\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 = false
tag = false
[alias]
# Inspired by https://coderwall.com/p/euwpig/a-better-git-log
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 remote get-url origin > /dev/null 2>&1 && (git checkout master || git checkout main) && git pull origin && 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 '(\\.idea/|/target/|build/)' | tr '\\n' '\\0' | xargs -r0 git clean -dx"
# Inspired by https://blog.gitbutler.com/how-git-core-devs-configure-git/
[column]
ui = auto
[branch]
sort = -committerdate
[tag]
sort = version:refname
[diff]
algorithm = histogram
colorMoved = plain
mnemonicPrefix = true
renames = true
[push]
default = simple
autoSetupRemote = true
followTags = true
[fetch]
prune = true
pruneTags = true
# </inspiration>
[branch]
autoSetupRebase = always
[rebase]
stat = true
autoStash = true
[pull]
rebase = true
[merge]
conflictStyle = zdiff3
[grep]
lineNumber = true
[log]
follow = true
[include]
path = .gitconfig.local
[init]
defaultBranch = master