]> git.phdru.name Git - dotfiles.git/blob - .gitconfig
.gitconfig: use `git var GIT_EDITOR`
[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 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; 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 = "!git add-alias --global"
102   add-local-alias = "!git add-alias --local"
103
104   tags = tag -n1 --list
105
106   # Find text in any commit ever
107   grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f"
108
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`"
117
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`"
122
123   # Get the current branch name
124   branch-name = rev-parse --abbrev-ref HEAD
125
126         branches = branch --all
127         ca = commit --all
128         cv = commit --verbose
129         cav = commit --all --verbose
130         cane = commit --amend --no-edit
131         checkin = commit
132         ci = commit
133         cat = cat-file -p
134         dump = cat-file -p
135         file = cat-file -t
136         type = cat-file -t
137         l1 = log --decorate --oneline
138         l5 = log --decorate -5
139         ld = log --decorate
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
153         #root = !pwd
154         root = rev-parse --show-toplevel
155         st = status --short
156         stb = status --short --branch
157         sd = show --decorate
158         sw = show --word-diff --decorate
159         unstage = reset HEAD --
160
161 [branch]
162         autosetuprebase = always
163
164 [color]
165         ui = auto
166
167 [include]
168         path = ~/lib/config/git/light_bg
169
170 [log]
171         abbrevCommit = true
172
173 [merge]
174         tool = vimdiff
175
176 #[mergetool "vimdiff3"]
177 # Don't forget to add -f for gvim
178 # 3 way diffs
179 #       cmd = vim -d \"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -c \"wincmd J\"
180
181 [push]
182         default = simple
183
184 [receive]
185         denyNonFastForwards = true
186
187 [web]
188         browser = webbrowser
189
190 [browser "webbrowser"]
191         cmd = webbrowser -n
192
193 [gui]
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