-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
159 lines (122 loc) · 6.98 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
[core]
editor = /usr/bin/vim
pager = cat
excludesfile = /Users/tim/.gitignore_global
[user]
name = Tim Malone
email = [email protected]
[commit]
gpgsign = true
[gpg]
program = /opt/homebrew/bin/gpg
[grep]
linenumber = true
[interactive]
singleKey = true
[push]
default = simple
[alias]
# Aliases are generally sorted in groups, but they could probably be sorted
# (and documented!) better.
# @see https://git-scm.com/docs/pretty-formats
lol = log --graph --pretty=format:'%C(auto)%h %C(green bold)%an %C(cyan)%ar%C(reset)%C(auto) %s%d' # Relative date.
lold = log --graph --pretty=format:'%C(auto)%h %C(green bold)%an %C(cyan)%aD%C(reset)%C(auto) %s%d' # Absolute date.
lola = log --all --graph --pretty=format:'%C(auto)%h %C(green bold)%an %C(cyan)%ar%C(reset)%C(auto) %s%d' # All branches.
# Commit and Push in one.
cp = !git commit $@ && git push
latest = !git lol -10
recent = !git latest
today = !git lol --since="00:00"
yesterday = !git lol --since=1.day --before=="00:00"
week = !git lol --since='last Monday'
merges = !git lol --merges
one = !git show --name-only $1
# Deletes a branch both locally AND remotely.
delbranch = !sh -c 'git branch -d $1 && git push origin --delete refs/heads/$1' -
dellocal = !sh -c 'git branch -D $1' -
# Creates a new branch off the current HEAD, and sets the upstream to the same name.
newbranch = !sh -c 'git checkout -b $1 && git push -u origin $1' -
# Gets merged branches, skips any branches we know we always want to keep (including the current
# one), trims whitespace, and then deletes the branches locally and remotely.
# NOTE: MIGHT NOT BE WORKING AT THE MOMENT - might need simplification/fixing.
#delmerged = "!f(){ git branch --merged | awk '{$1=$1};1' | egrep -v \"(^\\*)|(^(master)$)\" | sed 's,.,git delbranch \\0,e'; }; f"
# Gets merged branches, skips any branches we know we always want to keep (including the current
# one), trims whitespace, and then deletes the branches locally.
delmerged = "!git branch --merged | awk '{$1=$1};1' | egrep -v \"(^\\*)|(^(master)$)\" | xargs git branch -d"
uncommit = reset --soft HEAD~
unstage = !echo && git reset HEAD && echo && git status
unstash = stash pop
undo = !git uncommit && git unstage
amend = commit --amend --no-edit
grepall = !sh -c 'git rev-list --all --abbrev-commit | xargs git grep -n $1' -
grepalli = !sh -c 'git rev-list --all --abbrev-commit | xargs git grep -i -n $1' -
#git log --all --grep='pagerduty' # Version to grep through commit msgs instead
added = !git lold --diff-filter=A
deleted = !git lold --diff-filter=D
modified = !git lold --diff-filter=M
touch = !sh -c 'touch $1 && ls -la' -
# Sets up local tracking branches for EVERY remote branch.
# @see https://stackoverflow.com/a/10312587/1982136
# @see https://stackoverflow.com/a/14994923/1982136
allbranches = "!f() { git branch -r | grep -v '\\->' | while read remote; do git branch --track ${remote#origin/} $remote; done; }; f"
# Quick 'continuous integration'
# - Run as 'git ci' to merge the current branch into master and update everything
# - Run as 'git ci branch' to merge the current branch into 'branch' and update everything
# - Run as 'git ci branch tag' to merge current branch into 'branch' + tag with 'tag' + update
# Examples:
# - git ci # Merge a current branch eg. tim into master.
# - git ci tim # Merge a current eg. feature branch into tim.
# - git ci master v0.2.2 # Merge a current branch eg. tim into master and tag it v0.2.2.
ci = !sh -c 'git ci2 ${1+} "${1-master}" $(git current-branch) $2' -
ci2 = !echo && sh -c 'git checkout $1 && git merge --no-ff --no-edit --log $2 && "${3+git tag}" "${3-}" && git checkout $2 && git merge $1 && git update' -
current-branch = rev-parse --abbrev-ref HEAD
# Does a quick no-ff merge (with a few other options) from the current branch into the master (or
# specified) branch. Like git ci above, but doesn't merge back, doesn't update, and leaves you on
# the target branch ready to continue.
noff = !sh -c 'git noff2 ${1+} "${1-master}" $(git current-branch) $2' -
noff2 = !echo && sh -c 'git checkout $1 && git merge --no-ff --no-edit --log $2' -
todo = grep -i "todo"
branches = branch -vv
deltag = !sh -c 'git tag -d $1 && git push origin --delete $1' -
supertag = !git deltag $1 && git tag $1 && git push --tags origin
bump = !git commit -am "Version bump" && git tag $1 && git push && git push --tags
fix = !git add . && git stash && git stash drop && git status
conflict = grep \"<<<<<<<\"
statii = !echo && sh -c 'git latest && echo && git status && echo && git branch -vv && echo && git stash list' -
pullpush = !echo && sh -c 'git pull --all && echo && git pull --tags && echo && git push --all && echo && SKIP_HOOKS=true git push --tags' -
update = !sh -c 'git pullpush && echo && git statii' -
# Pull all branches from the remote.
# NOT TESTED YET.
pullall = !for remote in `git branch -r`; do git branch --track ${remote#origin/} $remote; done
purgeignore = !echo && git status && echo && git rm -r --cached . && echo && git add . && echo && echo && git status
changelog = log --pretty=format:'%C(cyan bold)%ai %C(auto)%d'
remotecp = !sh -c 'git --git-dir=C:/Users/Tim/Dropbox/Chromatix/htdocs/$0/assets/themes/child-theme/.git format-patch -k -1 --stdout $1 | git am -3 -k'
readme = !start chrome $(sed 's,\\.git,,g \n s,:,/,g \n s,git@,https://,g' <<< `git ls-remote --get-url`)
network = !~/Dropbox/Chromatix/htdocs/gitlab-network-graph/scripts/network.sh && start chrome "http://localhost/gitlab-network-graph"
wrike = !start chrome "https://www.wrike.com/open.htm?id=$(cat .wrike)"
web = !git network && git wrike
network2 = !start chrome $(sed 's,\\.git,/network,g \n s,:,/,g \n s,git@,https://,g' <<< `git ls-remote --get-url`)
releases = !start chrome $(sed 's,\\.git,/releases,g \n s,:,/,g \n s,git@,https://,g' <<< `git ls-remote --get-url`)
hub = !start chrome $(sed 's,\\.git,/,g \n s,:,/,g \n s,git@,https://,g' <<< `git ls-remote --get-url`)
tdmclone = !sh -c 'git clone [email protected]:tdmalone/'"${1}"'.git'
awsclone = !sh -c 'git clone ssh://git.tm.id.au/v1/repos/'"${1}"
awsauclone = !sh -c 'git clone ssh://git.au.tm.id.au/v1/repos/'"${1}"
awsusclone = !sh -c 'git clone ssh://git.us.tm.id.au/v1/repos/'"${1}"
kblmclone = !sh -c 'git clone [email protected]:KablamoOSS/'"${1}"'.git'
# Shortcut for 'git show --show-signature <commitish>'
sig = show --show-signature
whatedited = !sh -c 'git log --full-history -- '"${1}"
show-encrypted = !sh -c 'git-crypt status | grep -v \"not encrypted\"'
[filter "lfs"]
process = git-lfs filter-process
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
[pull]
rebase = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true