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 git rebase --interactive --autosquash $TARGET~; }; f"
81 incoming = !git remote update --prune; 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.' | colrm 1 6 | 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 = "!git add-alias --global"
102 add-local-alias = "!git add-alias --local"
104 tags = tag -n1 --list
106 # Find text in any commit ever
107 grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f"
109 # Edit all files of the given type
110 edit-cached = !"f() { git ls-files --cached | sort -u ; }; `git var GIT_EDITOR` `f`"
111 edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; `git var GIT_EDITOR` `f`"
112 edit-others = !"f() { git ls-files --others | sort -u ; }; `git var GIT_EDITOR` `f`"
113 edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; `git var GIT_EDITOR` `f`"
114 edit-killed = !"f() { git ls-files --killed | sort -u ; }; `git var GIT_EDITOR` `f`"
115 edit-modified = !"f() { git ls-files --modified | sort -u ; }; `git var GIT_EDITOR` `f`"
116 edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`"
118 # Editing and adding conflicted files: when we get many merge conflicts
119 # and want to quickly solve them using an editor, then add the files.
120 edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`"
121 add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
123 # Get the current branch name
124 branch-name = rev-parse --abbrev-ref HEAD
126 branches = branch --all
128 cv = commit --verbose
129 cav = commit --all --verbose
130 cane = commit --amend --no-edit
137 l1 = log --decorate --oneline
138 l5 = log --decorate -5
140 lg = log --decorate --graph
141 lg1 = log --decorate --graph --oneline
142 lg5 = log --decorate --graph -5
143 lr = log --decorate --reverse
144 lr1 = log --decorate --reverse --oneline
145 lr5 = log --decorate --reverse -5
146 null-merge = merge --strategy=ours
147 rbi123 = "!f() { exec git rebase --interactive $1 $2 ${3:-\"@{upstream\\}\"}; }; f"
148 rbi = !git rbi123 '' ''
149 rbia = !git rbi123 --autosquash ''
150 rbiap = !git rbi123 --autosquash --preserve-merges
151 rbip = !git rbi123 '' --preserve-merges
152 remotes = remote --verbose
154 root = rev-parse --show-toplevel
156 stb = status --short --branch
158 sw = show --word-diff --decorate
159 unstage = reset HEAD --
162 autosetuprebase = always
168 path = ~/lib/config/git/light_bg
176 #[mergetool "vimdiff3"]
177 # Don't forget to add -f for gvim
179 # cmd = vim -d \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -c \"wincmd J\"
185 denyNonFastForwards = true
190 [browser "webbrowser"]
194 fontui = -family \"DejaVu Sans\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
195 fontdiff = -family \"DejaVu Sans Mono\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0