-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
138 lines (138 loc) · 6.23 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
[user]
name = Deep Mistry
email = [email protected]
[pull]
rebase = true
[push]
default = simple
autoSetupRemote = true
[alias]
# abbreviations
rbm = rebase master
pr = pull --rebase
st = status -s
co = checkout
ci = commit
cia = commit --amend
cia-e = commit --amend --no-edit
br = branch
fpush = push --force
# watch log
watch = "!f() { while [ 1 ]; do clear; git log --all --oneline --decorate --graph; sleep 3; done; }; f"
# pretty log with graph output
lg = log --graph --pretty=format:'%C(yellow)%h%Cred -%C(auto)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --decorate --abbrev-commit --date=relative
# pretty log file details
ll = log --pretty=format:'%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]' --decorate --numstat
# pretty log with dates
ld = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=local
# pretty log with dates, first parent only
lf = log --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=local
# prettier blame
who = blame -c --show-stats --date=relative
# prettier and concise whatchanged
what = whatchanged --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=local --stat
# prettier whatchanged with full diffs
whatwhat = whatchanged --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=local -p
# prettier whatchanged with full diffs based on text search
whatwhen = whatchanged --pretty=format:'%C(yellow)%h %Cred%ad %Cblue%an%Cgreen%d %Creset%s' --date=local -p -S
# search the log for when given text was introduced
when = log -S
# list of files that have changed (with status)
changes = diff --name-status
# list of files that have changed
changed = diff --name-status
# diff - ignore whitespace
wdiff = diff -w
# smart diff shows the changes that matter on a very granular level
smartdiff = diff -w -b --patience
# list of changes since current branch diverge from master branch
mdiff = "!f() { git fetch; git diff origin/master...HEAD; }; f"
# list of changes since current branch diverge from master branch - ignore whitespace
mwdiff = "!f() { git fetch; git diff -w origin/master...HEAD; }; f"
# list of files that have changed (with status) since current branch diverge from master branch
mchanges = "!f() { git fetch; git diff --name-status origin/master...HEAD; }; f"
# list of files that have changed since current branch diverge from master branch
mchanged = "!f() { git fetch; git diff --name-only origin/master...HEAD; }; f"
# diff between two branchs
bdiff = "!f() { git diff $1...HEAD; }; f"
# list of files that have changed (with status) between two branches
bchanges = "!f() { git diff --name-status $1...HEAD; }; f"
# list of files that have changed between two branches
bchanged = "!f() { git diff --name-only $1...HEAD; }; f"
# get diff between HEAD and origin/HEAD
odiff = diff HEAD...origin/HEAD
# get diff between HEAD and origin/HEAD
ochanges = diff --name-status HEAD...origin/HEAD
# find files
f = "!git ls-files | grep -i"
# find files containing text
g = grep -Ii
# find out which branch contains a change
contains = branch --contains
# pretty print all commits which were introduced by a given merge. NOTE: requires merge commit as an argument!
introduced = "!f() { git log $(git merge-base --octopus $(git show $1 --format='%P'))..$(git show $1 --format='%H') --boundary --graph --pretty=oneline --abbrev-commit; }; f"
# used after a revert to show commands you'll need to run in order to reintroduce commits previously introduced by a given merge commit. NOTE: requires merge commit as an argument!
reintroduce = "!f() { git log $(git merge-base --octopus $(git show $1 --format='%P'))..$(git show $1 --format='%H') --format='git cherry-pick %H' --no-merges --reverse; }; f"
# list branchs that exist on local only
localonly = "!f() { LOCALS=$(git branch --list --no-color | cut -c 3-);REMOTES=$(git branch --all --no-color | grep 'remotes/origin' | grep -v HEAD | awk -F'/' '{print $3}');for R in $REMOTES; do LOCALS=$(echo \"$LOCALS\" | grep -v $R); done; echo \"$LOCALS\"; }; f"
# leaderboard
leaderboard = shortlog -s -n
# hard reset
hard = reset --hard
# hard reset to HEAD
hardhead = reset --hard HEAD
# hard reset to first parent
undo = reset --hard @^
# head commit
head = rev-parse HEAD
# head commit
shorthead = rev-parse --short HEAD
# cherry pick
pick = cherry-pick -x
# stash
save = stash -u
# stash pop
pop = stash pop
# copy given commit hash
copy = "!f() { REF=${1:-HEAD}; git rev-parse --short $REF | tr -d '\n' | pbcopy; }; f"
# fixup commit
fixup = !sh -c 'git commit -m \"fixup! $(git log -1 --format='\\''%s'\\'' $@)\"' -
# squash commit
squash = !sh -c 'git commit -m \"squash! $(git log -1 --format='\\''%s'\\'' $@)\"' -
# interactive rebase
ri = rebase --interactive --autosquash
# rebase last 2 commits
rilast = rebase --interactive --autosquash HEAD~2
# svn update commit
svnupdate = "!f() { svn update; git add -A; git commit -m 'svn update'; }; f"
# unapply stash
stash-unapply = !git stash show -p --no-color | git apply -R
# reset to guarenteed state
goto = "!f() { git fetch; git reset --hard $1; git clean -d -f; }; f"
# pull rebase
pullr = pull --rebase
# freebase
freebase = "!f() { git fetch; git rebase `git remote show | head -1`/$1; }; f"
# freeset
freeset = "!f() { git fetch; git reset --hard `git remote show | head -1`/$1; }; f"
# line count for given author
authorlines = "!f() { git log --author=\"$1\" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf \"added lines: %s, removed lines: %s, total lines: %s\\n\", add, subs, loc }' -; }; f"
[color]
ui = auto
status = auto
branch = auto
diff = auto
interactive = auto
[core]
editor = "vim -f"
autocrlf = false
fileMode = false
#[rerere]
#enabled = true
#autoupdate = true
[custom]
team = nav-profiles
[credential]
helper = osxkeychain
[branch]
autosetuprebase = always