2 # I copied some aliases from http://gitalias.com/ and other sources.
3 # Some I've added to gitalias. Some are mine.
5 # One letter alias for our most frequent commands.
30 be = branch --edit-description
34 bnm = branch --no-merged
50 # diff - show changes not yet staged
53 # diff - changes about to be commited
56 # diff - show changes but by word, not line
65 rbc = rebase --continue
69 # See https://blog.filippo.io/git-fixup-amending-an-older-commit/
70 # This is a slightly modified version
71 fixup = "!f() { TARGET=$(git rev-parse \"$1\"); git commit --fixup=$TARGET && GIT_EDITOR=true exec git rebase --interactive --autostash --autosquash $TARGET~; }; f"
81 incoming = !git remote update --prune; exec git log ..@{upstream}
82 outgoing = log @{upstream}..
85 push-to-all-remotes = !git remote | xargs -I% -n1 git push %
89 # show-branch - print a list of branches and their commits.
96 ssb = status --short --branch
98 aliases = "!git config --get-regexp '^alias\\.' | cut -c7- | sed 's/ / = /'"
100 add-alias = "!f() { [ $# = 3 ] && git config $1 alias.\"$2\" \"$3\" && return 0 || echo \"Usage: git add-(local|global)-alias <new alias> <original command>\" >&2 && return 1; }; f"
101 add-global-alias = "!exec git add-alias --global"
102 add-local-alias = "!exec git add-alias --local"
104 # Last tag in the current branch
105 lasttag = describe --tags --abbrev=0
107 # Latest annotated tag in all branches
108 lasttagged = !exec git describe --tags `exec git rev-list --tags --max-count=1`
111 tags = tag --list -n1
113 # Find text in any commit ever
114 grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f"
116 # Edit all files of the given type
117 edit-cached = !"f() { git ls-files --cached | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
118 edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
119 edit-others = !"f() { git ls-files --others | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
120 edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
121 edit-killed = !"f() { git ls-files --killed | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
122 edit-modified = !"f() { git ls-files --modified | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
123 edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
125 # Editing and adding conflicted files: when we get many merge conflicts
126 # and want to quickly solve them using an editor, then add the files.
127 edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; exec `exec git var GIT_EDITOR` `f`"
128 add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; exec git add `f`"
130 # Get the current branch name
131 branch-name = rev-parse --abbrev-ref HEAD
133 assume = update-index --assume-unchanged
134 unassume = update-index --no-assume-unchanged
135 # assume-all = "!git st -s | awk {'print $2'} | xargs git assume"
136 unassume-all = "!git assumed | xargs git update-index --no-assume-unchanged"
137 assumed = !"git ls-files -v | grep ^h | cut -c 3-"
141 branches = branch --all
143 cv = commit --verbose
144 cav = commit --all --verbose
145 cane = commit --amend --no-edit
149 dh = "!f() { git -c color.diff=always diff \"$@\" | perl /usr/share/doc/git/contrib/diff-highlight/diff-highlight | less; }; f"
150 dir = rev-parse --git-dir
156 l1 = log --decorate --oneline
157 l5 = log --decorate -5
159 lg = log --decorate --graph
160 lg1 = log --decorate --graph --oneline
161 lg5 = log --decorate --graph -5
162 lr = log --decorate --reverse
163 lr1 = log --decorate --reverse --oneline
164 lr5 = log --decorate --reverse -5
165 null-merge = merge --strategy=ours
166 rbi123 = "!f() { exec git rebase --interactive --autostash $1 $2 ${3:-\"@{upstream\\}\"}; }; f"
167 rbi = !exec git rbi123 '' ''
168 rbia = !exec git rbi123 --autosquash ''
169 rbiap = !exec git rbi123 --autosquash --preserve-merges
170 rbip = !exec git rbi123 '' --preserve-merges
171 remotes = remote --verbose
173 root = rev-parse --show-toplevel
174 status = status --no-short
176 stb = status --short --branch
178 sw = show --word-diff --decorate
179 unstage = reset HEAD --
181 # Github: pull request, Gitlab: merge request
182 mpr = "!f() { git fetch ${2:-origin} refs/$3/$1/head:pr/$1 && if [ \"$4\" = checkout ]; then git checkout pr/$1; fi; }; f"
183 fetch-mr = "!f() { git mpr $1 ${2:-origin} merge-requests; }; f"
184 merge-request = "!f() { git mpr $1 ${2:-origin} merge-requests checkout; }; f"
185 fetch-pr = "!f() { git mpr $1 ${2:-origin} pull; }; f"
186 pull-request = "!f() { git mpr $1 ${2:-origin} pull checkout; }; f"
187 clean-pr = "!git checkout master ; git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
190 autosetuprebase = always
196 indentHeuristic = true
199 fallbackToNoIndex = true
202 path = ~/lib/config/git/light_bg
205 defaultBranch = master
214 #[mergetool "vimdiff3"]
215 # Don't forget to add -f for gvim
217 # cmd = vim -d \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -c \"wincmd J\"
222 recurseSubmodules = check
225 #denyCurrentBranch = updateInstead
226 denyDeleteCurrent = true
228 #denyNonFastForwards = true
231 # sort = version:refname
242 signingKey = 6E080B70B6287B03
247 [browser "webbrowser"]
251 fontui = -family \"DejaVu Sans\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
252 fontdiff = -family \"DejaVu Sans Mono\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
254 # git:// protocol fixers
255 #[url "https://github.com/"]
256 # insteadOf = "git://github.com/"
257 #[url "https://gist.github.com/"]
258 # insteadOf = "git://gist.github.com/"
259 #[url "ssh://git@github.com/"]
260 # insteadOf = "git://github.com/"
261 #[url "ssh://git@gist.github.com/"]
262 # insteadOf = "git://gist.github.com/"
263 #[url "https://gitlab.com/"]
264 # insteadOf = "git://gitlab.com/"
265 #[url "https://gist.gitlab.com/"]
266 # insteadOf = "git://gist.gitlab.com/"
267 #[url "ssh://git@gitlab.com/"]
268 # insteadOf = "git://gitlab.com/"
269 #[url "ssh://git@gist.gitlab.com/"]
270 # insteadOf = "git://gist.gitlab.com/"
273 #[url "https://github.com/"]
274 # insteadOf = ssh://github.com/
275 # insteadOf = ssh://git@github.com/
276 # insteadOf = git@github.com:
278 #[url "ssh://git@github.com/"]
279 # insteadOf = https://github.com/
281 #[url "https://gitlab.com/"]
282 # insteadOf = ssh://gitlab.com/
283 # insteadOf = ssh://git@gitlab.com/
284 # insteadOf = git@gitlab.com:
286 #[url "ssh://git@gitlab.com/"]
287 # insteadOf = https://gitlab.com/