-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
145 lines (123 loc) · 6.43 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
142
143
144
[user]
# Forces user.email and user.name configuration variables to always be set
# when committing, useful when using multiple email addresses.
useconfigonly = true
[core]
editor = vim
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
autocrlf = input
pager = less -S -R
[pager]
log = diff-highlight | less -S -R
show = diff-highlight | less -S -R
diff = diff-highlight | less -S -R
# Treat spaces before tabs and all kinds of trailing whitespace as an error
whitespace = blank-at-eol,space-before-tab,indent-with-non-tab,-blank-at-eof
[color]
status = auto
diff = auto
branch = auto
interactive = auto
# User colorized output in Git commands (default since Git 1.8.4)
ui = auto
[color "status"]
untracked = yellow # Default is red
[commit]
# template = ~/.stCommitMsg
[push]
default = simple
# Make 'git push' push relevant annotated tags when pushing branches out
followTags = true
#[filter "lfs"]
# clean = git-lfs clean %f
# smudge = git-lfs smudge %f
# required = true
[alias]
# General
s = status -s
st = status
p = pull --ff-only --prune
# You don't always want to blame them
praise = blame
# Checkout
co = checkout
cof = "!f() { [ ${1:?'Search pattern missing'} ] && git co `git branch -a | grep -Eo \"feature/.*?$@.*\" | awk 'NR==1{print $1}'`; }; f" # checkout feature
cob = "!f() { [ ${1:?'Search pattern missing'} ] && git co `git branch -a | grep -Eo \"bugfix/.*?$@.*\" | awk 'NR==1{print $1}'`; }; f" # checkout bugfix
# Branch
br = branch -a --sort=-committerdate --format='%(color:green)%(committerdate) %09 %(if)%(HEAD)%(then)%(color:red)%(else)%(color:blue)%(end)%(refname:lstrip=2) %(color:white)by %(color:yellow)%(committername)'
# Create feature branch
cfb = "!f() { [ ${1:?'Arg missing'} ] && git checkout -b feature/$(sed 's/ä/ae/g; s/ö/oe/g; s/ü/ue/g; s/Ä/Ae/g; s/Ö/Oe/g; s/Ü/Ue/g; s/[^a-zA-Z0-9-]/_/g; s/__/_/g; s/[^a-zA-Z0-9]$//' <<< \"$@\"); }; f"
cfbf = "!f() { [ ${1:?'Arg missing'} ] && [ ${2:?'Arg missing'} ] && git checkout --no-track -b feature/$(sed 's/ä/ae/g; s/ö/oe/g; s/ü/ue/g; s/Ä/Ae/g; s/Ö/Oe/g; s/Ü/Ue/g; s/[^a-zA-Z0-9-]/_/g; s/__/_/g; s/[^a-zA-Z0-9]$//' <<< \"${@:2}\") $1; }; f"
cbb = "!f() { [ ${1:?'Arg missing'} ] && git checkout -b bugfix/$(sed 's/ä/ae/g; s/ö/oe/g; s/ü/ue/g; s/Ä/Ae/g; s/Ö/Oe/g; s/Ü/Ue/g; s/[^a-zA-Z0-9-]/_/g; s/__/_/g; s/[^a-zA-Z0-9]$//' <<< \"$@\"); }; f"
cbbf = "!f() { [ ${1:?'Arg missing'} ] && [ ${2:?'Arg missing'} ] && git checkout --no-track -b bugfix/$(sed 's/ä/ae/g; s/ö/oe/g; s/ü/ue/g; s/Ä/Ae/g; s/Ö/Oe/g; s/Ü/Ue/g; s/[^a-zA-Z0-9-]/_/g; s/__/_/g; s/[^a-zA-Z0-9]$//' <<< \"${@:2}\") $1; }; f"
dlb = "!f() { git branch -d ${1:?'Branch name missing'}; }; f"
Dlb = "!f() { git branch -D ${1:?'Branch name missing'}; }; f"
drb = "!f() { git push --delete ${2-'origin'} ${1:?'Branch name missing'}; git branch --delete --remotes ${2-'origin'}/${1}; }; f" # Delete remote branch
dmb = "!f() { git branch --merged | grep -v -E \"(^\\*|develop|master)\" | xargs git branch -d; }; f" # Delete merged branches
# Diff/Show
staged = diff --cached
# Diff between two commits below HEAD
dh = "!f() { git diff HEAD~${2:?'Arg missing'} HEAD~$1; }; f"
cs = "!f() { git rev-list --pretty=oneline `git merge-base ${1:?'Refspec for \"Since\" missing'} ${2-'HEAD'}`...${2-'HEAD'}; }; f" # Commits since
csd = "!f() { git cs develop; }; f"
cso = "!f() { git cs origin/$(git rev-parse --abbrev-ref HEAD); }; f" # Commits since push to origin
csr = "!f() { git cs ${1}/$(git rev-parse --abbrev-ref HEAD); }; f" # Commits since push to <remote>
tl = "!f() { git tag -l --format '%(tag) - %(taggerdate) - %(taggername) - %(subject)' | sort | less; }; f"
tagtype = "!f() { git cat-file -t refs/tags/$1 | sed 's/tag/annotated/;s/commit/lightweight/'; }; f"
hascommit = branch --contains
diff-remote = "!f() { git diff ${1}/$(git branch --show-current); }; f" # Diff to remote's copy of this branch
# Staging
unstage = reset HEAD --
addr = "!f() { git add \\*$@\\*; }; f"
ap = add -p
apr = "!f() { git add -p \\*$@\\*; }; f"
rp = reset -p
chmod = "!f() { git update-index --chmod=$1 \"$2\"; }; f"
# Stashing
stash = "!git stash --include-untracked"
spop = stash pop
spush = stash push
# Commit
cm = "!f() { git commit -F - <<< \"$@\"; }; f"
amend = commit --amend
fixup = "!f() { git commit --fixup=$1 ${@:2}; }; f"
# Push
pushto = "!f() { git push $1 ${2:-HEAD}; }; f"
pushtof = "!f() { git push $1 ${2:-HEAD} --force-with-lease; }; f"
# Rebase
rbi = rebase --interactive --rebase-merges
rbih = "!f() { git rbi --autosquash HEAD~${1:?'Arg missing'}; }; f"
rbid = "!git rbi --autosquash $(git merge-base $(git rev-parse --abbrev-ref HEAD) develop)"
rbib = "!f() { git rbi --autosquash $(git merge-base $(git rev-parse --abbrev-ref HEAD) ${1:?'Branch name missing'}); }; f"
rba = rebase --abort
rbc = rebase --continue
rbs = rebase --skip
rbr = "!f() { git discard .; git clean -df; git rebase --show-current-patch | git apply -3;}; f" # Reset current conflict resolution (i.e. reset this step of the rebase)
# Reset
discard = checkout --
rs = reset --soft
# Reset soft n commits below HEAD
rsh = "!f() { git rs HEAD~${1:?'Arg missing'}; }; f"
rh = reset --hard
# Reset hard n commits below HEAD
rhh = "!f() { git rh HEAD~${1:?'Arg missing'}; }; f"
# Merge
m = merge --no-ff --log
conflicts = "!f() { git format-patch $(git merge-base HEAD ${1:?'Arg missing'})..$1 --stdout | git apply --check -; }; f"
# Cherry-pick
cp = cherry-pick
cpa = cherry-pick --abort
cpc = cherry-pick --continue
# Log
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
logo = log --pretty=oneline
# Show who made the most commits because why not?
leaderboard = shortlog -sn
# Show the last 10 branches that I have worked on
recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format="%(refname:short)"
# Show today's accomplishments
today = "!git log --all --oneline --no-merges --author=`git config --get user.email` --since 'Today at 8 am'"
yesterday = "!git log --all --oneline --no-merges --author=`git config --get user.email` --since 'Yesterday at 8 am' --until 'Today at 8 am'"