-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitconfig
More file actions
144 lines (135 loc) · 5.81 KB
/
.gitconfig
File metadata and controls
144 lines (135 loc) · 5.81 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
[user]
name = Tomas Fiers
[github]
user = tfiers
[pull]
rebase = true
[submodule]
recurse = true
[push]
recurseSubmodules = on-demand
default = upstream
# What branch to push to when on `git push` (i.e. without refspec argument).
# Default is `simple`, which only pushes if remote name matches local name. I
# want to be able to have different names though (eg gh `tfiers/8/add-jb` vs
# local `add-jb`). `upstream` pushes to the remote branch marked `@{upstream}`
# in git.
[log]
date = format:%a %d-%b-%y %H:%M
# - Legend for these placeholers: [https://stackoverflow.com/a/34778736/2611913]
# - "date = human" is nice, but only available from git version 2.21
# onwards. See here for example outputs:
# [https://stackoverflow.com/a/54846195/2611913]
# - "date = local" is decent (but a bit weird).
# - This custom format I like the best in the end.
decorate = short
# Print 'ref names'(eg: "HEAD -> master, origin/master") besides
# commits that have them.
[format]
pretty = myshort
# Provide a default value for the `--pretty` (AKA `--format`) argument of eg
# `git log`.
[pretty]
myshort = format:%C(cyan)%h %<(60,trunc)%C(white)%s%C(auto)%d
dt = format:%C(cyan)%h %C(black bold)%ad %<(54,trunc)%C(white)%s %C(black bold)(%ar)%C(auto)%d
# Placeholders:
# %h Short hash.
# %ad Authoring date, formatted according to the `log.date` setting.
# Use `%cd` for commit date.
# %s Commit message subject.
# %ar Authoring date in 'relative' format.
# %d Ref names (see `log.decorate`), if present, wrapped in
# parentheses and prepended with a space.
# Adapted from [https://stackoverflow.com/a/34778736/2611913]
dtc = format:%C(cyan)%h %<(60,trunc)%C(white)%s%C(auto)%d%n%C(black bold) Created: %ad%n%C(black bold) Modified: %cd%n
[alias]
p = push
# In all the following Bash functions, yes, both `;` are necessary.
l = "!f() { git log ${1:--n 7}; }; f"
# Meaning of that piece of Bash argument syntax: "insert first argument,
# or, if not given, the default value (here: `-n 7`)".
ld = "!f() { git log --pretty=dt ${1:--n 7}; }; f"
lb = "!f() { git log --graph --branches --date-order ${1:--n 20}; }; f" # "log branches"
# Options:
# --graph Draw branch history with `|/\` characters. Every `*`
# is a commit. The line colors are confusing (they are
# random, and not related to the colors of the ref
# names); so don't mind them.
# --branches Do not only show ancestors of HEAD (i.e. current
# commit), but also from other refs (i.e. other
# branches).
# Replace with `--all` to also see remote (non-fetched) branches.
# --date-order The default (`--topo-order`) avoids showing commits
# from multiple 'lines of history' intermixed.
# `--date-order` explicitly shows all historical
# commits.
# Notes:
# - `git log` works on:
# - filenames
# - commit hashes
# - Get a commit's parent by appending `^` (and `^3` for
# great-grandparent).
# - To see all commits (paged), use
# - `git lb .`
# - `git lb --date-order`
lbd = "!f() { git log --pretty=dt --graph --all --date-order ${1:--n 20}; }; f"
addu = add -u
addi = add -i
s = status
ss = status --short
sms = submodule status
sa = stash # "stash away" or "stash all" or "stash: add"
sl = stash list
sp = stash pop
d = "!f() { git diff --word-diff=color ${1:-.}; }; f"
ds = "!f() { git diff --staged --word-diff=color ${1:-.}; }; f"
c = commit
ca = commit --amend
can = commit --amend --no-edit
cm = "!f() { git commit -m \"$1\"; }; f"
acm = "!f() { git add . ; git cm \"$1\"; }; f"
# - `add *` doesn't seem to work well in script. (It does work nicely
# when typed manually). Hence the `add .`s.
# - Yes, the 'double' quoting of the argument is necessary.
acan = "!f() { git add . ; git can; }; f"
go = "!f() { git cm \"$1\" ; git push; }; f"
ago = "!f() { git add . ; git cm \"$1\" ; git push; }; f"
gud = "!f() { git ago \"$1\"; }; f"
ri = "!f() { git rebase -i ${1:-HEAD~7}; }; f"
# Usage:
# - git ri {old_commit_hash}
# (This is short for `git ri {old_commit_hash}..HEAD`).
# - git ri HEAD~7
# (Short for `git ri HEAD~7..HEAD`).
rc = "rebase --continue"
rv = remote -v
rh = reset HEAD *
# Unstage all.
rl = reset --mixed HEAD~1
# Undo last commit.
# (Actual "git revert" command creates a new commit with reversals).
rlh = reset --hard HEAD~1
# Undo last commit, do not keep contents as unstaged changes.
sms = submodule status
[diff "jupyternotebook"]
command = git-nbdiffdriver diff
[merge "jupyternotebook"]
driver = git-nbmergedriver merge %O %A %B %L %P
name = jupyter notebook merge driver
[difftool "nbdime"]
cmd = git-nbdifftool diff \"$LOCAL\" \"$REMOTE\" \"$BASE\"
[difftool]
prompt = false
[mergetool "nbdime"]
cmd = git-nbmergetool merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
[mergetool]
prompt = false
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[advice]
useCoreFSMonitorConfig = false
# disable that "core.useBuiltinFSMonitor will be deprecated soon; use core.fsmonitor instead" message.