-
Notifications
You must be signed in to change notification settings - Fork 1
/
gitconfig
115 lines (105 loc) · 3.56 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
[core]
pager = less -E -F -X
excludesfile = ~/.gitignore
editor = "/opt/homebrew/bin/vim"
attributesfile = /Users/kold/.gitattributes
[color]
status = auto
diff = auto
interactive = auto
[alias]
bisect-fixed = bisect bad
bisect-unfixed = bisect good
ci = commit
cia = commit --amend
co = checkout
st = status
br = branch
sb = show-branch
sp = show -p
l = log
lp = log -p # always show patches
di = diff
sl = stash list
sa = stash apply
ss = stash save
mp = push origin master
mpd = push --dry-run origin master
pu = push
pudr = push --dry-run
rid = rebase master --ignore-date
unstage = reset HEAD
staged = diff --cached
cp = cherry-pick
rb = rebase
rbc = rebase --continue
rbs = rebase --skip
rl = reflog
undo = reset --soft HEAD^ #undo previous commit
bak = !git branch `git br | grep '*' | sed -e 's/* /BAK_/'` # create backup branch for current branch
prunelocal = !sh -c 'git branch -d `git branch --merged | grep -v \"^*\\|master\"`'
todo = grep --heading --break -e 'FIX:*' -e 'TODO:*'
# from http://gugod.org/2009/01/commonly-used-git-diff-aliases.html
d1 = diff HEAD^
d2 = diff HEAD^^
d3 = diff HEAD^^^
d4 = diff HEAD^^^^
d5 = diff HEAD^^^^^
d10 = diff HEAD^^^^^^^^^^
publish = !sh -c 'git push origin \"$0\" && git config \"branch.$0.remote\" origin && \
git config \"branch.$0.merge\" \"refs/heads/$0\"'
lg = log -n 15 --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative
lgau = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an> %Creset' --abbrev-commit --date=relative --author-date-order
lf = log --name-only
# from https://gist.github.com/1040523#gistcomment-37021
# prints a great report I can give to clients
lgp = log --pretty=format:'%aD %s'
# Print 7 most recent branches
# via http://stackoverflow.com/a/5972362
br7 = for-each-ref --count=7 --sort=-committerdate refs/heads/ --format='%(refname:short)'
br20 = for-each-ref --count=20 --sort=-committerdate refs/heads/ --format='%(refname:short)'
grep = grep -Ii
gr = grep -Ii
#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"
#grep on filename
f = "!git ls-files | grep -i"
#rename branch tree to done-
done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"
#assume aliases
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
#show assumed files
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
#unassume all the assumed files
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
#merges
ours = "!f() { git co --ours $@ && git add $@; }; f"
theirs = "!f() { git co --theirs $@ && git add $@; }; f"
#reset commands
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
[merge]
tool = vimdiff
[user]
name = Kevin Old
email = kevin@kevinold.com
[github]
user = kevinold
#token = 014480fe068924f8427822eef4362591
[rerere]
enabled = 1
#[gc]
#rerereresolved = never
[push]
default = current
[init]
defaultBranch = main
[hub]
protocol = ssh