-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
87 lines (87 loc) · 2.7 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
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
# local user config, usernames, etc
[include]
path = ~/.gitconfig.local
[credential]
helper = store
[core]
editor = vim
excludesfile = ~/.gitignore.global
pager = less -FRX
[merge]
tool = vimdiff
conflictstyle = diff3
[push]
default = simple
[tag]
sort = version:refname
[alias]
bb = branch -vv
# list branches removed from origin.
# usage: git bg | xargs git branch -D
bg = "!f() { git branch -vv | grep gone | cut -f3 -d' '; }; f"
cc = commit
co = checkout
ss = status
# update with upstream
up = !git pull --summary --rebase --prune $@ && git submodule update --init --recursive
# delete branches merged into specified branch
# $1 branch, master by default
bclean = "!f() { git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs -r git branch -d; }; f"
# authors with number of commits
authors = shortlog -s
# contribution by author, expected arguments
# $1 - author
authorstat = "!f() { \
git log --author=\"$1\" --pretty=tformat: --numstat | \
gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END \
{ printf \"added lines: %s removed lines: %s total lines: %s\\n\",add,subs,loc }' - ; \
}; f"
# changes for given period, expect arguments
# $1 - refs to compare: "@{1 week ago}", v0.2..master
shortstat = diff --shortstat
# count lines of code
loc = "!f() { git ls-files -z \"$@\" | wc -l --files0-from=- ; }; f"
ls = log --pretty=format:'%C(auto)%h%d %Cblue%cn%Creset %s' --decorate --numstat
# graphical commits tree
ll = log --graph --oneline --decorate
# graphical commits tree with names and dates
la = log --graph --pretty=format:'%C(auto)%h %ad%d %Cblue%an%Creset %s' --date=relative
# changes in file
lf = log -u
# pulled changes
fetchlog = log ORIG_HEAD.. --stat --no-merges
# resolve conflicts with gui
gitkconflict = !gitk --left-right HEAD...MERGE_HEAD
# upstream of current branch
show-upstream = rev-parse --abbrev-ref @{u}
# wipe unsaved changes
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
# reset to upstream
reset-upstream = "!f() { git reset --hard $(git show-upstream); }; f"
# add non-whitespace changes (whitespace=fix should deal with patch errors)
addw = "!f() { git diff -w $@ | git apply -v --cached --ignore-whitespace; }; f"
addwf = "!f() { git diff -w $@ | git apply -v --cached --whitespace=fix; }; f"
[color]
ui = auto
[fetch]
prune = true
[rebase]
autosquash = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[diff-so-fancy]
markEmptyLines = false
[pull]
rebase = true
[init]
defaultBranch = main