Skip to content

Instantly share code, notes, and snippets.

@dcai
Last active May 5, 2024 23:53
Show Gist options
  • Save dcai/2885623 to your computer and use it in GitHub Desktop.
Save dcai/2885623 to your computer and use it in GitHub Desktop.
git config gitconfig
root = true
[*]
indent_style = tab
*.php diff=php
[include]
path = ~/.gitconfig.local
[init]
defaultBranch = main
[blame]
date = relative
[http]
lowSpeedLimit = 100
lowSpeedTime = 3000
postBuffer = 1000M
maxRequestBuffer = 1000M
[format]
pretty = format:%C(yellow)%h%C(reset) %C(yellow)%d%C(reset) %s %C(bold blue)<%an> %C(green)(%cr)%C(reset)
[core]
; pager = delta
; pager = less
autocrlf = input
eol = lf
excludesfile = ~/.config/git/ignore
filemode = false
logallrefupdates = true
precomposeunicode = true
commitGraph = true
compression = 0
[commit]
gpgSign = false
[push]
default = current
followTags = true
recurseSubmodules = check
autoSetupRemote = true
[pull]
rebase = true
[instaweb]
local = true
httpd = webrick
port = 9999
[color]
branch = auto
diff = auto
interactive = auto
log = auto
status = auto
ui = auto
[alias]
b = branch
bc = branch --show-current
bd = branch -D
bl = branch --format='%(HEAD) %(color:yellow)%(committerdate:relative)\t%(color:red)%(refname:short)%(color:cyan)\n\t\t%(contents:subject) %(color:green) [%(authorname)]' --sort=-committerdate
bll = for-each-ref --sort='-committerdate' --format=\"%(color:blue)%(authordate:relative)\t%(color:white)%(authorname)\t%(color:green)%(refname:short)\" refs/remotes
ci = commit
co = checkout
cob = checkout -b
cobf = !git for-each-ref --format='%(refname:short)' refs/heads | fzf | xargs git checkout -b
cof = !git for-each-ref --format='%(refname:short)' refs/heads | fzf | xargs git checkout
cofr = !git for-each-ref --format='%(refname:lstrip=3)' refs/remotes | fzf | xargs git checkout
cot = !git tag | fzf | xargs -I {} git checkout -b {} {}
config-show-source-file=config --list --show-origin
conflicted = !vim +Conflicted
cpick = cherry-pick
d = diff --color-words --word-diff
dv = difftool -t vimdiff -y
difflast = !git last | xargs -o git show
diff-selected = !git editing-files | fzf | xargs -o git diff
discard-selected = !git editing-files | fzf -m | xargs -o git checkout --
delete-branches = "!git branch | grep -v '\\*' | fzf --multi | xargs git branch --delete --force"
delete-merged = "!git branch --merged | grep -v '\\*' | egrep -v 'main|master|develop|rc' | xargs git branch -d"
fetch = fetch --all --prune --tags --force
fixup = commit --no-verify --fixup HEAD
git = !exec git
committed-files = !git pickhash | xargs -o git show --format="format:" --name-only
editing-files = !git status --porcelain --no-renames | awk '{print $2}'
pickfile = !git committed-files | fzf --sync | sed -e "s#^#`git rev-parse --show-toplevel`/#" | xargs -o vim
; lastedited: list changed files in a commit, when no arg, list changesd files in HEAD
; last `sed` in pipe preppend git root dir to path
lastedited = ! sh -c 'git show --format="format:" --name-only $1 | grep -v "^$" | uniq | sed -e "s#^#`git rev-parse --show-toplevel`/#"' -
; vim: pick a file from change list and edit in vim
pickhash = !git log --abbrev-commit --color=always | fzf --sync --ansi | awk '{print $1}'
l = log --abbrev-commit --format=oneline --decorate=short
last = git show -s --format=%h
lasthash = !git log -n 1 --format=format:%H $1
lastmsg = !git log -n 1 --format=format:%B
ll = log --abbrev-commit
lll = log --abbrev-commit --graph
pf = push --force-with-lease
pr = ! sh -c 'git pull --all -r --tags && git submodule update' -
pull = pull --all -r --tags
push = push --tags
rb = !git -c sequence.editor=: rebase --autosquash -i origin/HEAD
rbc = rebase --continue
rebase = rebase --committer-date-is-author-date
reset-to=! sh -c 'git switch -C $(git branch --show-current) $1' -
ref=!git reflog | fzf
s = status
sm = submodule
smu = submodule update
s = status
stash = stash save --include-untracked
stu = status -uno -sb
undo = reset --soft HEAD^
unstage = reset HEAD
web = instaweb
; vim = ! sh -c 'vim $(git lastedited $1 | fzf)' -
; vim = ! sh -c 'vim $(git editing-files | fzf)' -
vim = !git editing-files | fzf | xargs -o vim
[merge]
tool = vimdiff
conflictstyle = diff3
[rerere]
enabled = true
autoupdate = 1
[gc]
auto = 0
rerereresolved = 60 days
reflogExpire = 120 days
[fetch]
prune = true
[diff]
compactionHeuristic = true
submodule = log
algorithm = patience
colorMoved = default
[rebase]
stat = true
autoStash = true
autoSquash = true
instructionFormat = <%aN> %s [%ar]
abbreviateCommands = true
missingCommitsCheck = warn
[credential]
helper = store --file ~/.git-credentials
[color "diff"]
meta = yellow bold
old = red dim
new = green italic
whitespace = red reverse
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[status]
showStat = true
showStash = true
submoduleSummary = true
relativePaths = true
[mergetool]
prompt = false
[pack]
windowMemory = 1G
packSizeLimit = 1G
threads = 1
deltaCacheSize = 65535
[add.interactive]
useBuiltin = false # required for git 2.37.0
[delta]
navigate = true # use n and N to move between diff sections
light = false # set to true if you're in a terminal w/ a light background color (e.g. the default macOS terminal)
; side-by-side = true
line-numbers = true
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[safe]
directory = *
set mainfont {{Lucida Grande} 11}
set textfont {Monaco 9}
set uifont {Menlo 13 bold}
set tabstop 8
set findmergefiles 0
set maxgraphpct 50
set maxwidth 16
set cmitmode patch
set wrapcomment none
set autoselect 1
set autosellen 40
set showneartags 1
set maxrefs 20
set visiblerefs {"master"}
set hideremotes 0
set showlocalchanges 1
set datetimeformat {%Y-%m-%d %H:%M:%S}
set limitdiffs 1
set uicolor grey85
set want_ttk 1
set bgcolor white
set fgcolor black
set uifgcolor black
set uifgdisabledcolor #999
set colors {"#99FF00" red blue magenta darkgrey brown orange}
set diffcolors {red "#00a000" blue}
set mergecolors {red blue "#99FF00" purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"}
set markbgcolor #e0e0ff
set diffcontext 3
set selectbgcolor gray85
set foundbgcolor yellow
set currentsearchhitbgcolor orange
set extdifftool opendiff
set perfile_attrs 0
set headbgcolor #99FF00
set headfgcolor black
set headoutlinecolor black
set remotebgcolor #ffddaa
set tagbgcolor yellow
set tagfgcolor black
set tagoutlinecolor black
set reflinecolor black
set filesepbgcolor #aaaaaa
set filesepfgcolor black
set linehoverbgcolor #ffff80
set linehoverfgcolor black
set linehoveroutlinecolor black
set mainheadcirclecolor yellow
set workingfilescirclecolor red
set indexcirclecolor #99FF00
set circlecolors {white blue gray blue blue}
set linkfgcolor blue
set circleoutlinecolor black
set geometry(main) 1600x893+93+111
set geometry(state) normal
set geometry(topwidth) 1600
set geometry(topheight) 165
set geometry(pwsash0) "459 1"
set geometry(pwsash1) "690 1"
set geometry(botwidth) 572
set geometry(botheight) 723
set permviews {}
.#*
.dropbox
.cvsignore
*.rej
*.orig
*.o
*.pem
*.class
*.pyc
log/*
tags*
# mac os stuff
.DS_Store
Icon
# Xcode
build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
*.xcworkspace
!default.xcworkspace
xcuserdata
profile
*.moved-aside
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment