Skip to content

Instantly share code, notes, and snippets.

@terrywang
Created May 18, 2025 03:46
Show Gist options
  • Save terrywang/42929c80cbccb24e818bc598c9cba4a7 to your computer and use it in GitHub Desktop.
Save terrywang/42929c80cbccb24e818bc598c9cba4a7 to your computer and use it in GitHub Desktop.
.gitconfig for macOS
[user]
name = Terry Wang
email = [email protected]
# signingkey = 3AA5C34371567BD2
[github]
user = terrywang
[includeIf "gitdir:~/work/"]
path = ~/work/.gitconfig.local
[core]
# Use custom `.gitignore` and `.gitattributes`
# excludesfile = ~/.gitignore
# attributesfile = ~/.gitattributes
# Treat spaces before tabs and all kinds of trailing whitespace as an error
# [default] trailing-space: looks for spaces at the end of a line
# [default] space-before-tab: looks for spaces before tabs at the beginning of a line
whitespace = space-before-tab,-indent-with-non-tab,trailing-space
# Make `git rebase` safer on OS X
# More info: <http://www.git-tower.com/blog/make-git-rebase-safe-on-osx/>
# trustctime = false
editor = vim
# pager = diff-so-fancy | less --tabs=4 -RFX
pager = delta --plus-style="#012800" --minus-style="#340001"
[diff]
tool = vimdiff
# detect copies as well as renames
renames = copies
# Enable an experimental heuristic that shifts the hunk boundary in an
# attempt to make the resulting patch easier to read.
indentHeuristic = true
[difftool]
prompt = false
[merge]
tool = vimdiff
# Include summaries of merged commits in newly created merge commit messages
log = true
[alias]
d = difftool
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
# Clone a repository including all submodules
c = clone --recursive
# View the current working tree status using the short format
s = status -s
# Show the diff between the latest commit and the current state
dd = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat"
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d"
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
ll = log --branches --graph --oneline --simplify-by-decoration
# difftastic
# Difftastic aliases, so `git dlog` is `git log` with difftastic and so on.
dlog = -c diff.external=difft log --ext-diff
dshow = -c diff.external=difft show --ext-diff
ddiff = -c diff.external=difft diff
# `git log` with patches shown with difftastic.
dl = -c diff.external=difft log -p --ext-diff
# Show the most recent commit with difftastic.
ds = -c diff.external=difft show --ext-diff
# `git diff` with difftastic.
dft = -c diff.external=difft diff
glog = "log --graph --topo-order --pretty='%w(100,0,6)%C(yellow)%h%C(bold)%C(black)%d %C(cyan)%ar %C(green)%an%n%C(bold)%C(white)%s %N' --abbrev-commit"
[color]
# Default since git 1.8.4
ui = auto
[color "diff"]
# meta = yellow bold
# frag = megenta bold
old = red strike
new = green italic
[apply]
# Detect whitespace errors when applying a patch
whitespace = fix
[pull]
ff = only
[interactive]
diffFilter = delta --color-only
#[commit]
# # https://help.github.com/articles/signing-commits-using-gpg/
# gpgsigh =true
#[http]
# cookiefile = ~/.gitcookies
#[gpg]
# program = gpg2
#[sendemail]
# smtpEncryption = tls
# smtpServer = smtp.gmail.com
# smtpUser = [email protected]
# smtpServerPort = 587
#[credential]
# helper = store --file ~/.git-credentials
# helper = cache --timeout 30000
[delta]
side-by-side = true
light = false
syntax-theme = zenburn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment