Last active
May 9, 2024 22:37
-
-
Save seth-macpherson/58f65f01a877741bd9c87d41c691dd3f to your computer and use it in GitHub Desktop.
Just a happy little .gitconfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[core] | |
# Use custom `.gitignore` and `.gitattributes` | |
attributesfile = ~/.gitattributes | |
editor = /opt/homebrew/bin/code -w | |
excludesfile = ~/.gitignore | |
ignorecase = false | |
noAheadBehind = true | |
pager = delta | |
preloadIndex = true | |
[user] | |
# Add the following in your zhrc for a completely flexible git config: | |
# export GIT_CONFIG_COUNT=3 | |
# export GIT_CONFIG_KEY_0="user.name" | |
# export GIT_CONFIG_VALUE_0=$GIT_AUTHOR_NAME | |
# export GIT_CONFIG_KEY_1="user.email" | |
# export GIT_CONFIG_VALUE_1=$GIT_AUTHOR_EMAIL | |
# export GIT_CONFIG_KEY_2="user.signingkey" | |
# export GIT_CONFIG_VALUE_2=$GIT_SIGNING_KEY | |
[advice] | |
detachedHead = false | |
[alias] | |
amend = commit --amend --no-edit | |
base = !git symbolic-ref refs/remotes/origin/HEAD | cut -d "/" -f 4 # this is used by many other aliases | |
br = branch | |
br-remote = !git branch -r | xargs -L1 git --no-pager show -s --oneline --author=$(git config user.email) | |
ci = "!f() { SHA=$(git log -n1 --pretty=format:"%H"); hub ci-status $SHA; }; f" | |
co = checkout | |
cp = cherry-pick --continue | |
d = difftool | |
diffdir = "difftool --dir-diff --no-prompt --no-symlinks" | |
difflast = difftool HEAD~1 | |
grep-add = "! f() { for filename in $(git diff --name-only -G\"$@\") ; do git add --patch $filename ; done }; f " | |
l = "!f() { esc=$(printf '\\033'); git --no-pager log --pretty=format:'%Cred%h%Creset %<|(28)%C(bold blue)%an%Creset %Cgreen%>(12,trunc)%cr%Creset %s' --abbrev-commit -n 25 --color; }; f" | |
latest = "! f() { base=$(git base); git fetch --prune --quiet && git checkout $base && git reset --hard origin/$base && git checkout - && git rebase - --quiet; }; f " | |
list-old = "!f() { base=$(git base); current=$(git rev-parse --abbrev-ref HEAD) && git branch --merged $base | grep --invert-match -e '$base' | grep --invert-match $current; }; f || echo 'No dead branches'" | |
list-old-remote = "!f() { base=$(git base); git branch --all --merged remotes/origin/$base | grep --invert-match -e '/$base' -e '/202' | grep --invert-match HEAD | grep 'remotes/origin/' | cut -d '/' -f 3-; }; f" | |
ls = log -n 20 | |
m = mergetool | |
pr = "!f() { gh pr view --web; }; f " | |
purge = "!f() { git list-old | xargs git branch -d; }; f" | |
purge-remote = "!f() { base=$(git base); git branch --all --merged remotes/origin/$base | grep --invert-match -e '/$base' -e '/202' | grep --invert-match HEAD | grep 'remotes/origin/' | cut -d '/' -f 3- | xargs git push origin --delete --no-verify; }; f" | |
rc = rebase --continue | |
remotes = remote -vq | |
resign = "!f() { git rebase --exec 'git commit --amend --no-edit -n -S' -i \"$1\"; }; f" | |
rs = restore --staged . | |
s = status --branch | |
s = status --branch | |
recent-changes = "!sh -c 'if [ -z $1 ]; then REVISION=HEAD; else REVISION=$1; fi; git difftool $REVISION~ $REVISION\\' -" | |
tags = tag -l | |
undo = "!f() { git reset --soft HEAD~1 && git restore --staged .; }; f" | |
[apply] | |
# Detect whitespace errors when applying a patch | |
whitespace = fix | |
[branch "master"] | |
# This is the list of cmdline options that should be added to git-merge | |
# when I merge commits into the master branch. | |
[branch] | |
autoseupmerge = always | |
mergeoptions = --ff-only | |
[checkout] | |
# number of parallel workers to use when checking out paths (processor count - 1) | |
workers = 7 | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = yellow | |
changed = green | |
untracked = cyan | |
[color] | |
ui = true | |
status = always | |
[commit] | |
gpgsign = true | |
[credential] | |
helper = store | |
[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 | |
[diff "rspec"] | |
xfuncname = "^[ \t]*((RSpec|describe|context|it|before|after|around|feature|scenario|background)[ \t].*)$" | |
[diff] | |
colorMoved = default | |
tool = bcomp | |
renames = true | |
[difftool "bcomp"] | |
trustExitCode = true | |
cmd = "/opt/homebrew/bin/bcomp" --no-symlinks \"$LOCAL\" \"$REMOTE\" | |
[difftool] | |
prompt = false | |
[format] | |
pretty = format:%h %Cblue%ad%Creset %ae %Cgreen%s%Creset | |
[gpg] | |
program = /opt/homebrew/bin/gpg | |
[init] | |
templatedir = ~/.git_templates | |
defaultBranch = main | |
[interactive] | |
diffFilter = delta --color-only | |
[log] | |
date = relative | |
max-count = 20 | |
[merge] | |
# Include summaries of merged commits in newly created merge commit messages | |
log = true | |
renames = true | |
[merge] | |
tool = bcomp | |
[mergetool "bcomp"] | |
keepBackup = false | |
prompt = false | |
trustExitCode = true | |
cmd = "/opt/homebrew/bin/bcomp" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\" | |
[oh-my-zsh] | |
hide-status = 0 | |
[protocol] | |
version = 2 | |
[pull] | |
rebase = true | |
[push] | |
default = current | |
autoSetupRemote = true | |
[rebase] | |
autosquash = true | |
keepBackup = false | |
[url "git://gist.github.com/"] | |
insteadOf = "gist:" | |
[url "git://github.com/"] | |
insteadOf = "github:" | |
[url "[email protected]:"] | |
insteadOf = "gst:" | |
pushInsteadOf = "gist:" | |
pushInsteadOf = "git://gist.github.com/" | |
[url "[email protected]:"] | |
insteadOf = "gh:" | |
pushInsteadOf = "github:" | |
pushInsteadOf = "git://github.com/" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment