-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitconfig
119 lines (100 loc) · 3.38 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
; User identification
[user]
name = Brian Richards
email = [email protected]
; Custom
[alias]
; List all aliases
la = "!git config -l | grep alias | cut -c 7-"
; basic shortcuts
cl = clone
f = fetch
; info
logs = log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
st = status -s
dc = diff --cached
diff = diff --word-diff
; Committing
a = add -p
aa = add
ci = commit
cam = commit -am
; Branching
br = branch
co = checkout
com = "!git checkout $(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')" ; gets the main/default branch name
cob = checkout -b
; pushing
p = push
pf = push --force
; rebasing
ro = "!git rebase origin/$(git symbolic-ref --short HEAD);" ; rebase current branch from origin
roi = "!git rebase -i origin/$(git symbolic-ref --short HEAD);" ; interactively rebase current branch from origin
fr = "!f(){ CURRENT=$(git symbolic-ref --short HEAD); git fetch origin $CURRENT && git rebase origin/$CURRENT; }; f" ; fetch and rebase current branch from origin
fri = "!f(){ CURRENT=$(git symbolic-ref --short HEAD); git fetch origin $CURRENT && git rebase -i origin/$CURRENT; }; f" ; fetch and interactively rebase current branch from origin
move = "!f(){ CURRENT=$(git symbolic-ref --short HEAD); git checkout -b $1 && git branch --force $CURRENT ${3-'$CURRENT@{u}'} && git rebase --onto ${2-main} $CURRENT; }; f"
; reset
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
; history
filelog = log -u
fl = log -u
dl = "!git ll -1"
dlc = diff --cached HEAD^
dr = "!f() { git diff "$1"^.."$1"; }; f"
lc = "!f() { git ll "$1"^.."$1"; }; f"
diffr = "!f() { git diff "$1"^.."$1"; }; f"
; search
; f = "!git ls-files | grep -i"
grep = grep -Ii
gr = grep -Ii
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"
; assume
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
assumeall = "!git st -s | awk {'print $2'} | xargs git assume"
; tags
lasttag = describe --tags --abbrev=0
lt = describe --tags --abbrev=0
; stash
sl = stash list
sa = stash apply
ss = stash save
;git-svn
svnr = svn rebase
svnd = svn dcommit
svnl = svn log --oneline --show-commit
log = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
; Environment
[core]
editor = code
symlinks = true
filemode = false
filemode = false
filemode = false
;autocrlf = true
[color]
ui = auto
branch = auto
diff = auto
interactive = auto
status = auto
; Notes
; Most aliases from:
; http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
; http://blog.kfish.org/2010/04/git-lola.html
;
; Git config parts taken from:
; http://coderjournal.com/2011/04/gitconfig/
[push]
default = current
[init]
defaultBranch = main
[credential]
helper = osxkeychain