-
Notifications
You must be signed in to change notification settings - Fork 7
/
gitconfig
112 lines (94 loc) · 3.72 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
[alias]
ci = commit
cim = commit -m
ciam = commit -am
ciaam = "!git add -A && git ciam"
co = checkout
cod = checkout -
st = status -sb
br = branch
diffc = diff --cached
pl = pull
ps = push
pls = "!git pull && git push"
pick = cherry-pick
pick-all = !sh -c '(git show $1 2>&1 > /dev/null || (git fetch origin && git show $1 2>&1 > /dev/null)) && git co staging && git pull && git pick $1 $2 && git pls && git co production && git pull && git pick $1 $2 && git pls && git co master && git pull' -
uncommit = reset --soft HEAD^
amend = commit -a --amend --no-edit
amendm = commit -a --amend # amend with message
rmuntracked = clean -df
l = log --pretty=format:'%h %an %Cred%ar %d %Cgreen%s'
rmb = !sh -c '(git branch -D $1 >/dev/null 2>&1 || true) && (git push origin :$1 >/dev/null 2>&1 || true) && rm .git/refs/remotes/origin/$1 >/dev/null 2>&1' - # using semiconol -> syntax error :/
rbm = !"br=$((test -e .git/refs/remotes/origin/main && echo main) || echo master) && git fetch origin && git rebase origin/$br"
adrc = "!git add . && git rebase --continue"
adpc = "!git add . && git pick --continue"
clear = "!git reset .; git co .; git clean -f"
parent-update = "!br=$((test -e .git/refs/remotes/parent/main && echo main) || echo master);git co $br && git fetch parent && git reset --hard parent/$br && git checkout - && git rebase $br"
amend-to = !sh -c 'git stash && git edit $1 && git stash pop && git edit --amend' -
rprune = "!git checkout master && git pull && git remote prune origin && git branch --merged | grep -v '*' | xargs git branch -d && git for-each-ref refs/heads/ '--format=%(refname:short)' | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == '-'* ]] && git branch -D $branch; done"
# delete all branches except master/main/current(*)
yeet = "!git branch | grep -v 'master\\|main\\|\\*' | xargs git branch -D "
# perform an action on all git repositories in the current directory (for example git all pull)
all = "!f() { for i in `ls`; do if [ -d $i/.git ]; then echo \"$i\n--------------------------\"; git -C $i $1; echo; fi; done; }; f"
# show modified files for given ref
modified = "!sh -c 'git diff-tree --no-commit-id --name-only -r $1' -"
# shortcuts so I get autocomlete
stached-switch = "!~/dotfiles/bin/git-stached-switch"
edit = "!~/dotfiles/bin/git-edit"
request = "!~/dotfiles/bin/git-pull-request"
whence = "!git-whence"
[apply]
whitespace = nowarn
[diff]
rename = copy
compactionHeuristic = true
noprefix = true
[color]
branch = auto
diff = auto
status = auto
ui = true
[color "branch"]
current = green
local = blue
remote = yellow
#normal status has added/changed = green untracked/deleted/conflic = red -> more colors
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
pager = delta --syntax-theme='GitHub' # https://github.com/dandavison/delta
excludesfile = ~/.gitignore
[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
[interactive]
diffFilter = delta --color-only
[push]
default = current
autoSetupRemote = true # create remote branch if none exists
[branch]
autosetuprebase = always # rebase when pulling
sort = -committerdate
[pull]
rebase = true
[rebase]
autoStash = true
[rerere]
enabled = true # store resolved rebase steps even when aborted
[hub]
protocol = https
[fetch]
prune = true # prune deleted branches when pulling
[advice]
skippedCherryPicks = false