-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
141 lines (119 loc) · 4.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
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
[alias]
a = add
aa = diff --cached
ap = add -p
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
bc = "!f() { git branch --merged | egrep -v \"(^\\*|master|staging)\" | xargs git branch -d; }; f"
bls = ls-remote --heads
br = for-each-ref --format='%(refname:short) -> %(upstream:short)' refs/heads
brm = branch -D
cln = clean -df
co = checkout
cob = checkout -b
c = commit --verbose
ca = "!f() { export GIT_COMMITTER_DATE=\"$(git show -s --format=%ai HEAD)\"; git commit -a --amend --no-edit --verbose --date \"$GIT_COMMITTER_DATE\"; }; f"
caf = "!f() { git ca; git puf; }; f"
cp = checkout -p HEAD
cpm = checkout -p master
cm = commit -m
cam = commit -a -m
cmp = "!f() { git commit -m \"$1\"; git push; }; f"
camp = "!f() { git commit -a -m \"$1\"; git push; }; f"
campn = "!f() { git commit -a -m \"$1\"; git push --no-verify; }; f"
d = diff
dashboard = "!f() { /usr/local/bin/grv -repoFilePath /stemn/stemn-backend \"$@\"; }; f"
db = "!git diff $(git merge-base $(git branch | grep \\* | cut -d ' ' -f2) master) $(git branch | grep \\* | cut -d ' ' -f2)"
dbl = "!git diff --name-only $(git merge-base $(git branch | grep \\* | cut -d ' ' -f2) master) $(git branch | grep \\* | cut -d ' ' -f2)"
ds = diff --stat
f = fetch --all
# provide help by listing aliases
h = "!git config -l | grep alias | cut -c 7-"
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ll = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
m = merge
p = pull
pp = "!git pull --no-edit; git push"
pu = push
puf = push -f
pun = push --no-verify
puu = "!git push -u origin $(git branch | awk '/^\\* / { print $2 }')"
# create a pull request. first argument is pull request name.
pr = "!f() { \
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD); \
PR_NAME=${1-$BRANCH_NAME}; \
git add .; \
git cm $PR_NAME; \
git push -u origin $BRANCH_NAME:$PR_NAME; \
hub pull-request -b develop -h $PR_NAME -m \"[WIP] ${PR_NAME}\"; \
}; f"
r = remote -v
ra = "!f() { git remote add $1 [email protected]:$2.git; }; f" # usage: git ra remote-name username/repository | adds a remote pointing to a repository
rbm = "!git rebase -i $(git merge-base $(git branch | grep \\* | cut -d ' ' -f2) master)"
s = status
su = status --untracked-files=no
search = "!f() { git rev-list --all | GIT_PAGER=cat xargs git grep \"$@\"; }; f"
# interactively split current branch into two branches
# doesnt allow BASH-style if statements
split = "!f() { \
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD); \
UUID=$(cut -c-4 /proc/sys/kernel/random/uuid); \
\
git status; \
echo ""; \
echo \\<======================== G I T ---- S P L I T ========================\\>;\
echo [Please select the changes to store to the $BRANCH_NAME branch]; \
echo [NOTE: Leftover unstaged changes will be automatically pushed to the split branch]; \
if $(echo $BRANCH_NAME | grep -qE '\\-split\\-'); \
then SPLIT_NAME=${BRANCH_NAME}-${UUID}; \
else SPLIT_NAME=${BRANCH_NAME}-split-${UUID}; \
fi; \
\
git branch -c $BRANCH_NAME $SPLIT_NAME; \
read -p 'press ENTER to interactively select changes\n' BLANK; \
git add --interactive; \
\
read -p 'Enter the commit message for your selected changes: ' COMMIT_MSG; \
git commit -m \"$COMMIT_MSG\"; \
git push; \
\
read -p 'press ENTER to push leftover changes to the split branch\n' BLANK; \
git stash push --no-keep-index --include-untracked; \
\
git checkout $SPLIT_NAME; \
git branch --unset-upstream; \
git stash pop; \
\
read -p 'Enter the commit message for the leftover changes: ' COMMIT_MSG; \
git add -A; \
git commit -am \"$COMMIT_MSG\"; \
git push -u origin $SPLIT_NAME; \
}; f"
[push]
default = current
[core]
safecrlf = false
pager = diff-so-fancy | less -RFX
[sequence]
editor = rebase-editor
[interactive]
singleKey = true
[color]
ui = true
[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
[diff]
interHunkContext = 0
[user]
email = [email protected]
name = Jackson Delahunt