-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
92 lines (69 loc) · 2.43 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
# Notes
# Good one: https://blog.gitbutler.com/git-tips-and-tricks/
# filter out paths: git show :^{path}
# blame:
# git blame -L m,n path/to/file
# git blame -L :'func main' path/to/file
# git blame -w -C -C -C -L 100,200 path/to/file
# commits touching lines:
# git log -L m,n:path/to/file
# git diff --word-diff (csia)
# seq 1 24 | git column --mode=column --padding=5
# git ls-remote <name>
# switch:
# git switch <branch>
# git switch -c <branch> (new branch)
# restore:
# git restore <file>
# git restore --source HEAD@{10.minute.ago} <file>
# git restore -p <file> (patch by hunk)
# precommit & husky (hooks)
# attributes:
# echo '*.png diff=exit' >> .gitattributes
# git config diff.exif.textconv exiftool
# smudge & clean (lfs): staging area vs working directory
# git config filter.dater.smude <script>
# git config filter.dater.clean <script|command>
# echo 'date*.rb filter=dater' >> .gitattributes
# rebase & commit:
# git commit -a --fixup=<commit> (base of correct)
# git rebase --autosquash
# git rebase --update-refs -i main (rebasing stacks, multiple branches)
# worktrees:
# 1. working on more than one branch at a time
# 2. provide a new working dir for each branch
# git worktree add -b bugfix ../branches/bugfix
# cd ../branches/bugfix
# shared object database
# make git reuse recorded resolution
[core.rerere]
enabled = true
autoUpdate = true
[gpg]
format = ssh
[user]
signingKey = ~/.ssh/id_rsa.pub
[branch]
sort = -committerdate
[includeIf "gitdir:~/work/"]
path = ~/.gitconfig-work
[includeIf "gitdir:~/oss/"]
path = ~/.gitconfig-oss
[color]
ui = auto
[alias]
s = status
ls = ls-tree --full-tree --name-only -r HEAD
fza = "!git ls-files -m -o --exclude-standard | fzf --print0 -m | xargs -0 -t -r git add"
fzc = "!git for-each-ref --format='%(refname:short)' refs/heads | fzf --print0 | xargs -0 -t -r git checkout"
als = "!git config --list | grep 'alias\\.' | sed 's/alias\\.\\([^=]*\\)=\\(.*\\)/\\1\\ \t => \\2/' | sort"
lg = log --graph --pretty=format:'%Cred%h%Creset - %Cgreen(%cr) %C(yellow)%d%Creset %C(cyan)%s%Creset %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
hist = log --pretty=format:'%Cred%h%Creset - %Cgreen%ad%Creset | %C(cyan)%s%d%Creset %C(bold blue)[%an]%Creset' --graph --date=short
pr = "!f() { git fetch ${2:-origin} pull/$1/head:pr$1; git checkout pr$1; }; f"
fpush = "push --force-with-lease"
[init]
defaultBranch = main
[merge]
conflictStyle = zdiff3
[rebase]
updateRefs = true