]> git.phdru.name Git - dotfiles.git/blob - .gitconfig
.gitconfig: add (un)assume aliases
[dotfiles.git] / .gitconfig
1 [alias]
2 # I copied some aliases from http://gitalias.com/ and other sources.
3 # Some I've added to gitalias. Some are mine.
4
5   # One letter alias for our most frequent commands.
6   a = add
7   b = branch
8   c = commit
9   d = diff
10   f = fetch
11   g = grep
12   l = log
13   m = merge
14   o = checkout
15   p = pull
16   r = remote
17   s = status
18   w = whatchanged
19
20   ### add ###
21
22   aa = add --all
23
24   ap = add --patch
25
26   au = add --update
27
28   ### branch ###
29
30   be = branch --edit-description
31
32   bm = branch --merged
33
34   bnm = branch --no-merged
35
36   ### commit ###
37
38   cm = commit --message
39
40   ### checkout ###
41
42   co = checkout
43
44   ### cherry-pick ###
45
46   chp = cherry-pick
47
48   ### diff ###
49
50   # diff - show changes not yet staged
51   dc = diff --cached
52
53   # diff - changes about to be commited
54   ds = diff --staged
55
56   # diff - show changes but by word, not line
57   dw = diff --word-diff
58
59   ### rebase ###
60
61   rb = rebase
62
63   rba = rebase --abort
64
65   rbc = rebase --continue
66
67   rbs = rebase --skip
68
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 --autosquash $TARGET~; }; f"
72
73   ### remote ###
74
75   rs = remote show
76
77   ru = remote update
78
79   rp = remote prune
80
81   incoming = !git remote update --prune; exec git log ..@{upstream}
82   outgoing = log @{upstream}..
83
84   # Push to all remotes
85   push-to-all-remotes = !git remote | xargs -I% -n1 git push %
86
87   ### show-branch ###
88
89   # show-branch - print a list of branches and their commits.
90   sb = show-branch
91
92   ### status ###
93
94   ss = status --short
95
96   ssb = status --short --branch
97
98   aliases = "!git config --get-regexp '^alias\\.' | colrm 1 6 | sed 's/ / = /'"
99
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"
103
104   # Last tag in the current branch
105   lasttag = describe --tags --abbrev=0
106
107   # Latest annotated tag in all branches
108   lasttagged = !git describe --tags `git rev-list --tags --max-count=1`
109
110   # List all tags
111   tags = tag --list -n1
112
113   # Find text in any commit ever
114   grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f"
115
116   # Edit all files of the given type
117   edit-cached = !"f() { git ls-files --cached | sort -u ; }; exec `git var GIT_EDITOR` `f`"
118   edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; exec `git var GIT_EDITOR` `f`"
119   edit-others = !"f() { git ls-files --others | sort -u ; }; exec `git var GIT_EDITOR` `f`"
120   edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; exec `git var GIT_EDITOR` `f`"
121   edit-killed = !"f() { git ls-files --killed | sort -u ; }; exec `git var GIT_EDITOR` `f`"
122   edit-modified = !"f() { git ls-files --modified | sort -u ; }; exec `git var GIT_EDITOR` `f`"
123   edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; exec `git var GIT_EDITOR` `f`"
124
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 `git var GIT_EDITOR` `f`"
128   add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; exec git add `f`"
129
130   # Get the current branch name
131   branch-name = rev-parse --abbrev-ref HEAD
132
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-"
138
139         branches = branch --all
140         ca = commit --all
141         cv = commit --verbose
142         cav = commit --all --verbose
143         cane = commit --amend --no-edit
144         checkin = commit
145         ci = commit
146         cat = cat-file -p
147         dump = cat-file -p
148         file = cat-file -t
149         type = cat-file -t
150         l1 = log --decorate --oneline
151         l5 = log --decorate -5
152         ld = log --decorate
153         lg = log --decorate --graph
154         lg1 = log --decorate --graph --oneline
155         lg5 = log --decorate --graph -5
156         lr = log --decorate --reverse
157         lr1 = log --decorate --reverse --oneline
158         lr5 = log --decorate --reverse -5
159         null-merge = merge --strategy=ours
160         rbi123 = "!f() { exec git rebase --interactive $1 $2 ${3:-\"@{upstream\\}\"}; }; f"
161         rbi = !exec git rbi123 '' ''
162         rbia = !exec git rbi123 --autosquash ''
163         rbiap = !exec git rbi123 --autosquash --preserve-merges
164         rbip = !exec git rbi123 '' --preserve-merges
165         remotes = remote --verbose
166         #root = !exec pwd
167         root = rev-parse --show-toplevel
168         st = status --short
169         stb = status --short --branch
170         sd = show --decorate
171         sw = show --word-diff --decorate
172         unstage = reset HEAD --
173
174 [branch]
175         autosetuprebase = always
176
177 [color]
178         ui = auto
179
180 [include]
181         path = ~/lib/config/git/light_bg
182
183 [log]
184         abbrevCommit = true
185
186 [merge]
187         tool = vimdiff
188
189 #[mergetool "vimdiff3"]
190 # Don't forget to add -f for gvim
191 # 3 way diffs
192 #       cmd = vim -d \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -c \"wincmd J\"
193
194 [push]
195         default = simple
196
197 [receive]
198         denyNonFastForwards = true
199
200 [web]
201         browser = webbrowser
202
203 [browser "webbrowser"]
204         cmd = webbrowser -n
205
206 [gui]
207         fontui = -family \"DejaVu Sans\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0
208         fontdiff = -family \"DejaVu Sans Mono\" -size 18 -weight normal -slant roman -underline 0 -overstrike 0