-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_gitconfig
More file actions
182 lines (126 loc) · 4.13 KB
/
dot_gitconfig
File metadata and controls
182 lines (126 loc) · 4.13 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
[core]
pager = delta
# Avoid problems when changing a case of a filename
ignorecase = false
excludesfile = ~/.config/git/ignore
untrackedcache = true
fsmonitor = true
[init]
templatedir = ~/.config/git/templates
defaultbranch = main
[gpg]
program = gpg
[user]
name = Marek Kaczkowski
email = marek.kaczkowski@gmail.com
signingkey = 1F5EFF52F238B326
[commit]
gpgsign = false
[tag]
gpgsign = false
[log]
date = iso
[status]
# Show untracked files, directories and files in untracked directories
showuntrackedfiles = all
submodulesummary = true
[interactive]
difffilter = delta --color-only
[pull]
# Keep local commits on top of the tree
rebase = true
[merge]
conflictstyle = zdiff3
[rebase]
# Stash and pop uncommitted changes on rebase
autostash = true
autosquash = true
updaterefs = true
# Maintain a 1-1 mapping to upstream refs and tags
[fetch]
prune = true
prunetags = true
fsckobjects = true
[transfer]
fsckobjects = true
[receive]
fsckobjects = true
[branch]
sort = committerdate
[diff]
colormoved = default
algorithm = histogram
[help]
# Run corrected command after 1 second
autocorrect = 20
[delta]
navigate = true # use n and N to move between diff sections
light = false
side-by-side = true
[alias]
# List all the git aliases
aliases = !sh -c 'git config --get-regexp '^alias\\.' | sed -e s/^alias\\.// -e s/\\ /\\ =\\ / | sort'
# Project clone to ~/Repositories
pclone = '!git -C $HOME/Repositories clone'
# Replace latest commit
amend = commit --amend
# Add files to last commit
append = commit --amend --no-edit
# List remote-tracking and local branches
branches = branch --all -v
# Checkout or create new branch
ck = "!f() { git checkout $1 2>/dev/null || git checkout -b $1; }; f"
co = checkout
# Remove untracked and ignored files interactively
cleanup = clean -xfdi
# Commit no verify (disable hooks)
cnv = commit -n -m
# Count the number of files changed in the current branch compared to main
count-files = !git diff --name-only main... | wc -l
# Count number of commits ahead of main
count-commits = !git rev-list --count main..`git branch --show-current`
dd = !git --no-pager diff
# Clean up all current changes
discard = "!f() { git restore ${1:-.}; }; f"
# Filter the commit logs messages with the provided string
filter = "!f() { git logs --grep=$1; }; f"
last = log -1 HEAD --stat
lg = log --pretty=format:\"%C(magenta)%h%Creset -%C(red)%d%Creset %s %C(dim green)(%cr) [%an]\" --abbrev-commit
lp = log --pretty=format:'%Cred%h%Creset %C(yellow)%d%Creset %s %Cgreen(%cr)%Creset - %C(magenta)%cn%Creset' --abbrev-commit --date=relative
main = !git checkout main && git pull
develop = !git checkout develop && git pull
# Clean up merged branches to a given branch ("main" is default)
purge = "!f() { git branch -r --merged | grep ${1:-main} | cut -d "/" -f 2 | xargs -r git branch -d; }; f"
pwl = push --force-with-lease
# Remove a remote branch
rmrb = push origin -d
# Grep the given pattern in tracked files with line numbers and context
search = grep -n -C 1
# Short status
s = status -sb
# Show numstat between main and HEAD
stat = diff --shortstat main HEAD
# Stash the working directory, the index and the untracked files
stash-all = stash save --include-untracked
# Pull rebase remote main
sync = "!f() { git pull origin ${1:-main} --rebase; }; f"
# List tags and sort them by version number
tags = tag -l --sort=-version:refname
# Show a graph of the commit logs
tree = log --graph --full-history --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s %C(green)(%cr) %C(bold blue)[%an]%C(reset)'
# Revert the last commit and put its changes in the index
undolast = reset --soft HEAD^
unstage = reset HEAD --
# Push and set upstream origin for branch
up = !git push -u origin `git branch --show-current`
ut = "!f() { git push origin --tags ${1:-}; }; f"
wt = worktree
wtls = worktree list
wtrm = worktree remove
[color "branch"]
current = yellow reverse
local = yellow
remote = green
# reuse recorded resolution
[rerere]
enabled = true