-
Notifications
You must be signed in to change notification settings - Fork 0
/
gitconfig
115 lines (103 loc) · 3.92 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
[user]
name = Brendan Roy
email = br3ndanr@gmail.com
signingkey = Brendan Roy <br3ndanr@gmail.com>
[core]
pager = diff-so-fancy | less --tabs=4 -RFX
[commit]
verbose = true
gpgsign = true
[push]
default = current
followTags = true
[submodule]
recurse = true
[log]
decorate = true
# I _frequently_ use the following commands - these are some of the best
# parts of my gitconfig.
#
# `git lg` displays a repository's commit log with a graph depicting branches
# and other nice features like relative time and tags. I use this more often
# than `git log`, however `git log` remains useful for inspecting commits in
# more detailed manner.
#
# `git add --patch` is absolutely my number 1 favorite command (thank you
# @LiamKeene for converting me). It allows you to interactively stage portions
# of changed files for commit. This is an incredible tool, as it allows you to
# both doublecheck all your changes in a commit, as well as break a large set
# of updates into smaller, logical commits. Additionally, this will help
# you catch unintentional changes, such as accidentally adding/removing lines
# or characters, or leaving debug breakpoints in code.
# I cannot reccomend this command enough. I use it extremely frequently, and
# as such have aliased it to `git pat`.
#
# I really like the output format of `branch -vv` so I've aliased it to `br`.
[alias]
dash = diff --cached
# nicer git log
lg = log --color --graph --pretty=format:'%C(magenta)%h%Creset %C(bold blue)<%an>%Creset %C(dim red)%cr%Creset - %s%C(yellow)%d%Creset' --abbrev-commit
changelog = !git log --graph --pretty=format:'%D %s' --abbrev-commit | sed 's/HEAD....master, //' | sed 's/, origin.master, origin.HEAD//g' | less
br = branch -vv
# Today I discovered you can start an alias with ! to execute it as a shell
# function rather than a simple git alias. Pretty neat!
# git pat is git add --intent-to-add . which adds new files to tracking but
# doesn't stage their contents yet, then an add --patch afterward. This
# means I can now patch add new files (not just changed ones)!
pat = !git add -N . && git add --patch
# brdel fetches, then lists all the branches. Branches which are tracking
# a now deleted upstream branch are listed as ': gone'. If your upstream
# is squash merging branches, you can use this to delete those branches
# once they are deleted upstream. Very handy!
brdel = !git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
# pulp is a simple pull then push routine.
pulp = !git pull && git push
# this will cause git to remember credentials for 43200 seconds (12 hours)
[credential]
helper = cache --timeout=43200
# which program to use when signing commits and tags
[gpg]
program = gpg
# the next two definitions are shorthand for upstream sources, eg:
# `git clone gh:bmon/dotfiles`
# instead of
# `git clone git@github.com:bmon/dotfiles`
#
# I haven't seen much reference to using `insteadOf` like this at all, but it
# hasn't broken anything for me since I added this setting in 2015.
[url "git@github.com:"]
insteadOf = gh:
insteadOf = https://github.com
[url "git@git.sr.ht:"]
insteadOf = srht:
[url "git@source.servian.com:"]
insteadOf = serv:
# I have a second gitconfig located under work git directories
# which defines additional settings, specific to work repositories
# (different public key, different email, etc)
[includeIf "gitdir:~/git/mx51/"]
path = ~/git/mx51/.gitconfig
[color]
status = auto
diff = auto
branch = auto
interactive = auto
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[pull]
rebase = false
[init]
defaultBranch = master
[http]
cookiefile = /home/brendan/.gitcookies