-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgitconfig.common
More file actions
134 lines (103 loc) · 6.58 KB
/
gitconfig.common
File metadata and controls
134 lines (103 loc) · 6.58 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# vim: set ft=gitconfig:
[status]
submoduleSummary = true
[diff]
# Better algorithm
algorithm = histogram
# Show code movement in different colors to added/removed
colorMoved = plain
# Replace a/ and b/ with where the diff is coming from, e.g. i/ (index), w/ (working directory), c/ (commit)
mnemonicPrefix = true
# Spend more time to determine files that are renamed
renames = true
submodule = log
[branch]
sort = -committerdate
[color]
ui = auto
[column]
ui = auto
[core]
editor = vim
abbrev = 12
fsmonitor = true
untrackedCache = true
# Changing the -r to a -R seems to help with keeping track of the screen. Also
# use -S to chop lines as this seems to make sense in most git commands
pager = less -iwRS
[push]
default = upstream
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --oneline --decorate -20
la = log --pretty=la --decorate --date=short -20
# log with files modified
lm = log --pretty=format:"%Cred%h%C(yellow)%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
# list branches by recently modified
ba = "!git for-each-ref --sort=-authordate refs/heads --format='%(authordate:relative)%09%(objectname:short)%09%(authorname)%09%(refname:short)'"
bc = "!git for-each-ref --sort=-committerdate refs/heads --format='%(committerdate:relative)%09%(objectname:short)%09%(authorname)%09%(refname:short)'"
# branch list sorted by most recent commit
bl = branch --sort=-committerdate
# Common pull variations
puff = pull --ff-only
pure = pull --rebase
mine = "!git log --author \"$(git config --get user.name)\""
ma = "!git log --author \"$(git config --get user.name)\" --pretty=la --decorate --date=short"
# Git log with a tree based structure
lg = log --graph --date=relative --date-order --pretty=format:'%Cgreen%h %Creset• %<(80,trunc)%s (%C(blue)%an%C(reset), %C(green)%cr%C(reset)) %C(auto)%d%Creset'
lgt = log --graph --date=relative --topo-order --pretty=format:'%Cgreen%h %Creset• %<(80,trunc)%s (%C(blue)%an%C(reset), %C(green)%cr%C(reset)) %C(auto)%d%Creset'
# See what happened in a git pull
news = log -p HEAD@{1}..HEAD@{0}
# Show content (full diff) of a commit given a revision
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-HEAD} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git ll $a $r^..$r -- $f\"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
# find a file path in codebase
f = !git ls-files -c -o --exclude-standard | grep --color=auto -i
# Grep from root folder
gra = "!f() { A=$(pwd) && TOPLEVEL=$(git rev-parse --show-toplevel) && cd $TOPLEVEL && git grep --full-name -In $1 | xargs -I{} echo $TOPLEVEL/{} && cd $A; }; f"
gb = "!f() { git grep -n $1 | while IFS=: read i j k; do git blame -L $j,$j $i | cat; done }; f"
# Show the last tag
lasttag = describe --tags --abbrev=0
# Merge aliases
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
ls-files-ignored = !sh -c 'git ls-files --others -i --exclude-standard'
logc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-HEAD} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git log $a $r^..$r -- $f\"; }; f"
diffc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-HEAD} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git diff $a $r^..$r -- $f\"; }; f"
loginc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git log $a ..$r -- $f\"; }; f"
linc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git ll $a ..$r -- $f\"; }; f"
logout = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git log $a $r.. -- $f\"; }; f"
lout = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git ll $a $r.. -- $f\"; }; f"
diffinc = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git diff $a ...$r -- $f\"; }; f"
diffout = "!f() { local r a f; r=`git rev-parse --revs-only \"$@\"` && r=${r:-'@{u}'} && a=`git rev-parse --sq --no-revs --flags \"$@\"` && f=`git rev-parse --sq --no-revs --no-flags \"$@\"` && cd ./$GIT_PREFIX && eval \"git diff $a $r... -- $f\"; }; f"
unstage = reset HEAD --
remerge = checkout -m --conflict=diff3 --
st = status -sb
fixup = commit --amend -C HEAD
rup = remote -v update
aliases = !git config -l | grep ^alias\\. | cut -c 7-
info = for-each-ref --format=\"%(refname:short) <= %(upstream:short)\" refs/heads
# git change-commits GIT_AUTHOR_EMAIL "old@email.com" "new@email.com"
# git change-commits GIT_COMMITTER_EMAIL "old@example.com" "new@example.com"
change-commits = "!f() { VAR=$1; OLD=$2; NEW=$3; shift 3; git filter-branch --env-filter \"if [[ \\\"$`echo $VAR`\\\" = '$OLD' ]]; then export $VAR='$NEW'; fi\" $@; }; f"
[pretty]
la = tformat:%C(yellow)%h%Creset%C(bold red)%d%Creset %s %C(bold blue)<%an>%Creset %C(green)%ad%Creset
la-nc = tformat:%h%d %s <%an> %ad
graph = format:%C(yellow)%h%Creset%x09%C(bold blue)%an%C(reset)%x09%ad%x09%C(auto)%d%C(reset) %<(75,trunc)%s
[pager]
ll = false
la = false
[difftool "nvimdir"]
cmd = nvim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' "$LOCAL" "$REMOTE" '+syntax off'
[merge]
conflictstyle = "zdiff3"
tool = "nvimdiff4"
prompt = true
[mergetool "nvimdiff4"]
cmd = nvim -d $LOCAL $BASE $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[rerere]
enabled = true
autoupdate = true
[tag]
sort = version:refname