Skip to content

Instantly share code, notes, and snippets.

@gnprice
Last active September 22, 2024 17:43
Show Gist options
  • Save gnprice/5f71b63464a76bd7e0480f207b1bbff3 to your computer and use it in GitHub Desktop.
Save gnprice/5f71b63464a76bd7e0480f207b1bbff3 to your computer and use it in GitHub Desktop.
gitconfig
# This is a snapshot of my ~/.gitconfig file, minus a few bits
# that are obsolete or non-reusable.
#
# For explanation of each setting, see `git help config`
# or https://git-scm.com/docs/git-config .
#
[user]
name = Greg Price
email = [email protected]
[alias]
st = status
di = diff
ls = ls-files
ci = commit
dc = diff --cached
rc = rebase --continue
ca = commit --amend
git = !git
testci = "!testci () { echo $1 >$1 && git add $1 && git commit -m $1; }; testci"
k = log --decorate --oneline --graph --boundary
pff = pull --ff-only
co = checkout
mff = merge --ff-only
refs = for-each-ref --format=%(refname)
kk = log --graph --boundary --pretty=format:'%Cred%h%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>'
s = status --short
view = log --decorate --oneline --graph --boundary --all HEAD
lv = log --decorate --oneline --graph --boundary --branches HEAD --not --tags --remotes=origin --remotes=upstream --not
lvm = log --decorate --oneline --graph --boundary --branches HEAD --remotes=me --not --tags --remotes=origin --remotes=upstream --not
rac = !git add -u && git rebase --continue
lsp = log --stat -p
usp = log --stat -p @{u}.. --reverse
uv = log --decorate --oneline --graph --boundary @{u}..
rh = reset --hard
# Makes useful headings to paste into a GitHub review.
rv = "!f () { range=${1:-@{u\\}..}; git log --reverse --format='#### %h %s%n%n%n%n' \"$range\"; }; f"
[color]
ui = auto
[push]
default = current
[merge]
conflictstyle = diff3
defaultToUpstream = true
[rebase]
stat = true
[core]
excludesfile = ~/.gitexclude
pager = LESS=-iRFX less
abbrev = 9
commitgraph = true
# These require installing `diff-highlight` on your PATH.
# Handy for making diffs easier to read.
#[pager]
# log = diff-highlight | LESS=-iRFX less
# show = diff-highlight | LESS=-iRFX less
# diff = diff-highlight | LESS=-iRFX less
#[interactive]
# diffFilter = diff-highlight
# This is a handy feature, when it occasionally comes into action...
# but awfully surprising if you're not expecting it.
# Best enabled only after reading `git help rerere`.
#[rerere]
# enabled = true
# These require having the respective programs installed on your PATH.
# They're also only relevant if you have files in the respective formats.
#[diff "ipynb"]
# textconv = jupyter nbconvert --to markdown --stdout --log-level=0
# cachetextconv = true
#[diff "doc"]
# textconv = antiword
# cachetextconv = true
#[diff "odf"]
# textconv = odt2txt
# cachetextconv = true
[log]
mailmap = true
[format]
thread = shallow
[branch]
autosetupmerge = always
[pull]
rebase = true
[diff]
noprefix = true
# Use color to identify code that was moved around verbatim.
[diff]
# Enable the feature.
colorMoved = zebra
# Supercharge it to do the equivalent of `git diff -b`.
# The ideal criterion would be pure leading-whitespace changes;
# but "allow-indentation-change" actually allows whitespace
# changes anywhere, even breaking up words.
colorMovedWS = ignore-space-change
[color "diff"]
# The default colors stay within the classic 16-color palette,
# which is pretty constraining: old/"-" lines are bold magenta
# or bold blue, and new/"+" lines are cyan or yellow. With a
# modern terminal emulator, we can do much better.
#
# Our approach: Old/"-" and new/"-" lines should be in reddish
# and greenish hues, consistent with non-moved code.
#
# We also add a faint gray (or yellow-gray) background, to
# help mark it as moved in a way that reduces emphasis --
# assuming a black terminal background. If using a light
# terminal background, then substituting light gray in these
# backgrounds should give the same effect.
oldMoved = "#ff0077 #222222"
oldMovedAlternative = "#ff3322 #222a00"
newMoved = "#00cc77 #222222"
newMovedAlternative = "#66aa00 #222a00"
[gc]
reflogExpire = never
reflogExpireUnreachable = never
writecommitgraph = true
[url "[email protected]:"]
insteadOf = salsa:
[url "[email protected]:"]
insteadOf = gh:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment