-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgitconfig
147 lines (120 loc) · 5.13 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
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
135
136
137
138
139
140
141
142
143
144
145
146
147
[user]
name = Ben Wheatley
email = [email protected]
signingkey = CE78DCE7A8FF3A42
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[color]
ui = true
[core]
excludesfile = ~/.gitignore.global
hookspath = ~/.git-hooks
[include]
path = .gitconfig.github
[alias]
s = status
st = status -s
ss = status -s -uno
c = commit
cm = commit -m
d = difftool
l = log
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %Cblue<%an>' --abbrev-commit --date=relative
lgf = log --graph --pretty=format:'%Cred%h%Creset - %Cgreen%cI%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %Cblue<%an>' --abbrev-commit
unstage = reset HEAD
lgp = log --reverse --abbrev-commit --format='%h: %s%n%n%b'
f = fetch --all --tags --prune
p = push
# Remote update, fetch remote info only
ru = remote update
# Remote log diff, shows commits which exist remotely but not locally
rl = log HEAD..origin/master
rlp = log -p HEAD..origin/master
logn = !git log $(git merge-base origin/master HEAD)...HEAD
lognr = !git logn --reverse
pushbranch = push -u origin HEAD
gud = "!f(){ BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u}); git reset --hard "$BRANCH"; }; f"
realgud = "!f(){ git fetch --all; BRANCH=$(git rev-parse --abbrev-ref --symbolic-full-name @{u}); git reset --hard "$BRANCH"; }; f"
# https://stackoverflow.com/a/33244119
catchup = "!f(){ echo -n \"reset \\033[0;33m$(git symbolic-ref -q --short HEAD)\\033[0m to \\033[0;33m$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD))\\033[0m? (Y/n) \"; read -r ans; if [ \"$ans\" = \"y\" -o \"$ans\" = \"Y\" -o -z \"$ans\" ]; then git reset --hard $(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)); else echo \"catchup aborted\"; fi }; f"
# Switch branch
sb = "!f(){ git fetch --all; git checkout $1; }; f"
ch = rev-parse HEAD
pr = "!f(){ github-open-pr; }; f"
# https://blog.theodo.fr/2017/06/git-game-advanced-git-aliases/
# Show which commits are safe to amend/rebase
unpushed = log @{u}..
# Show what you've done since yesterday to prepare your standup
standup = "!f() { git log --since yesterday --author=$(git config user.email) --oneline --all ; }; f"
myhist = "!f() { git log --since '6 months ago' --author=$(git config user.email) --oneline --all ; }; f"
# Show the history difference between a local branch and its remote
divergence = log --left-right --graph --cherry-pick --oneline $1...origin/$1
# Quickly solve conflicts using an editor and then add the conflicted files
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; vim `f`"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add `f`"
# https://github.com/nagoya-foundation/co-authored-commit
co-commit = "!co_authored_commit(){ usage='usage: git commit -m \"Commit message\" --co \"co_author_name\"\n'; while [ \"${#}\" -gt 0 ]; do case \"${1}\" in -m) shift; message="${1}"; shift;; --co) shift; co_author=\"Co-authored-by: \"${1}\"\n\"; co_authors=\"${co_authors}${co_author}\"; shift;; *) shift;; esac; done; if [ -z \"${co_authors}\" ]; then echo ${usage}; exit 1; fi; if [ -z \"${message}\" ]; then echo ${usage}; exit 1; fi; co_authored_message=\"${message}\n\n\n${co_authors}\"; git commit -m \"${co_authored_message}\"; }; co_authored_commit"
co-author = !git commit --amend --message=\"$(git show --format=%B --no-patch HEAD)\" --message=\"$(printf 'Co-Authored-By: %s <%s>' \"$(git config --get user.name)\" \"$(git config --get user.email)\")\"
[commit]
gpgsign = true
[rebase]
autostash = true
[push]
default = tracking
[diff]
tool = vimdiff
noprefix = true
[difftool]
prompt = false
[merge]
tool = sublime_merge
prompt = true
[mergetool "vimdiff"]
cmd = nvim -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'
[mergetool "sublime_merge"]
trustExitCode = true
cmd = smerge mergetool \"$BASE\" \"$LOCAL\" \"$REMOTE\" -o \"$MERGED\"
[url "[email protected]:"]
insteadOf = https://github.com/
[pull]
# Refuse to do anything but a fast-forward when executing a plain `git pull`.
ff = only
# Nicer diffs
# https://dandavison.github.io/delta/configuration.html
[core]
pager = delta
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
features = decorations
[delta "interactive"]
keep-plus-minus-markers = false
[delta "decorations"]
commit-decoration-style = blue ol
commit-style = raw
file-style = omit
hunk-header-decoration-style = blue box
hunk-header-file-style = red
hunk-header-line-number-style = "#067a00"
hunk-header-style = file line-number syntax
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true