Skip to content

Instantly share code, notes, and snippets.

@melcloud
Created October 3, 2024 10:28
Show Gist options
  • Save melcloud/6852bd5b6b984559938962f6ba4fc9dc to your computer and use it in GitHub Desktop.
Save melcloud/6852bd5b6b984559938962f6ba4fc9dc to your computer and use it in GitHub Desktop.
# .gitconfig
[includeIf "gitdir:~/codes/personal/"]
path = ~/.gitconfig-personal
[includeIf "gitdir:~/codes/work/"]
path = ~/.gitconfig-work
[include]
path = ~/.gitconfig-extra
# gitconfig-work
[user]
name = <>
email = <>
# gitconfig-extra
[fetch]
prune = true
[pull]
ff = true
[push]
autoSetupRemote = true
gpgSign = if-asked
[branch]
autoSetupRebase = remote
[rerere]
enabled = true # Enable resolve recording for conflict
[merge]
tool = vimdiff
conflictStyle = zdiff3
[mergetool]
KeepBackup = false
prompt = true
[diff]
tool = vimdiff
conflictStyle = zdiff3
[difftool]
prompt = true
[alias]
up = pull --rebase --prune --autostash
st = status
ci = commit
re = restore .
ri = rebase -i
co = switch
cob = switch -c
cp = cherry-pick
br = branch
hash = show -s --format=%H
who = shortlog -s --
amend = commit -a --amend
undo = reset HEAD~1 --mixed
unstage = reset HEAD --
save = !git add -A && git commit -m 'SAVEPOINT'
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --all
prune-local = !git branch --merged | grep -v -E '(main|master|develop)$' | xargs -n 1 git branch -d
prune-remote = !git remote | xargs -n 1 git remote prune
delete-tag = "!f() { git tag -d $1; git push origin :refs/tags/$1; }; f"
[core]
pager = diff-so-fancy | less --tabs=4 -RF
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
func = 146 bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment