-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
86 lines (78 loc) · 2.63 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
[user]
name = 𝑾𝒖𝒙𝒉
email = wxh1220@gmail.com
signingkey = wuxh
[core]
excludesfile = /Users/wuxh/.gitignore_global
ignorecase = true
# ref: https://stackoverflow.com/a/36427485/11302760
# ref: https://code.visualstudio.com/docs/editor/versioncontrol#_vs-code-as-git-editor
editor = code --disable-extensions --wait
# ref: https://code.visualstudio.com/docs/editor/versioncontrol#_vs-code-as-git-diff-tool
[diff]
tool = default-difftool
[difftool "default-difftool"]
cmd = code --disable-extensions --wait --diff $LOCAL $REMOTE
[mergetool "vscode"]
cmd = code --wait $MERGED
[alias]
co = checkout
cob = checkout -b
cor = checkout --orphan # 创建无历史记录的分支
coo = !git fetch && git checkout
# br see: https://stackoverflow.com/a/36517935/11302760
br = "!f() { git checkout -b $(whoami)/$1; }; f"
brd = branch -d
st = status
aa = add -A .
unstage = reset --soft HEAD^
cm = commit -m
# random cow: export COW=$(cowsay -l | tail -n +2 | tr ' ' '\n' | sort -R | head -n 1);\
# cm = "!f() {\
# export MSG=$(echo $1 | cowsay -f small);\
# export TITLE=$(echo $1);\
# git commit -m \"$TITLE\" -m \"$MSG\" -m \"$COW\";\
# }; f"
cmt = commit --template=/Users/wuxh/.stCommitMsg
amend = commit --amend --no-edit # 个人需求调整
# 一鸣惊人(ZWSP): https://codepoints.net/U+200B, https://git-scm.com/docs/git-commit#_commit_information
amaze = "!f() {\
export EMPTY=$(printf \"\\xE2\\x80\\x8B\");\
export GIT_AUTHOR_NAME=$EMPTY;\
export GIT_AUTHOR_EMAIL=$EMPTY;\
export GIT_AUTHOR_DATE='2049-10-1T12:00:00+0800';\
export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME;\
export GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL;\
export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE;\
git commit -m $EMPTY --allow-empty --no-verify --no-gpg-sign --no-edit;\
}; f"
empty = amaze
fix = commit --fixup
undo = reset HEAD~1
rv = revert
cp = cherry-pick
pu = !git push origin `git branch --show-current`
fush = push -f
mg = merge --no-ff
rb = rebase
rbc = rebase --continue
rba = rebase --abort
rbs = rebase --skip
rom = !git fetch && git rebase -i origin/master --autosquash
save = stash push
pop = stash pop
apply = stash apply
rl = reflog
# beautify log
lg = log --graph --pretty=format:'%Cred%h%Creset - %C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# commit total count
count = rev-list --all --count
# open vscode
code = !code --disable-extensions
[commit]
gpgsign = true
# template = /Users/wuxh/.stCommitMsg
[includeIf "gitdir:~/Code/company/"]
path = ~/.gitconfig_work
[init]
defaultBranch = master