Skip to content

Instantly share code, notes, and snippets.

@skalpin
Last active June 2, 2022 19:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skalpin/5b880ac8121fc60a84404597ab360c19 to your computer and use it in GitHub Desktop.
Save skalpin/5b880ac8121fc60a84404597ab360c19 to your computer and use it in GitHub Desktop.
.gitconfig
[alias]
branch-name = rev-parse --abbrev-ref HEAD
d = diff --word-diff
f = fetch -p --tags
m = !git merge origin/$(git branch-name)
st = status -s
ci = commit
co = checkout
amend = commit --amend --no-edit
setbugbase = !git config variable.working-base release
setbase = !git config variable.working-base develop
base = !git config variable.working-base
br = branch
lg = log --color --graph --pretty=format:'%Cred%h%Creset %s%C(yellow)%d%Creset %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgc = log --color --graph --min-parents=2 -p -c --pretty=format:'%Cred%h%Creset %s%C(yellow)%d%Creset %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgl = log --graph --full-history --all --date=format:'%Y-%m-%d %H:%M:%S, %a' --format='%h %d%n%x09%x09 %C(blue bold)%an%Creset, %C(magenta)%ad (%ar)%Creset:%n%x09%x09 %Cgreen\"%s\"'
lin = !git lg ..origin/$(git branch-name)
lout = !git lg origin/$(git branch-name)..
in = "!f() { git lg ..origin/$1; }; f"
out = "!f() { git lg origin/$1..; }; f"
publish = !git push -u origin $(git branch-name)
unpublish = !git push origin :$(git branch-name)
pushf = push --force-with-lease
nf = "!f() { git checkout -b features/$1 origin/$2 --no-track; }; f"
nwh = !echo 'git nw [abbrev] [workitem] [description] [from branch]'
nw = "!f() { git worktree add -b features/$2-$3 ../$1_$2 origin/$4 --no-track; }; f"
nb = "!f() { git checkout -b bugs/$1 origin/$2 --no-track; }; f"
gl = "!f() { git pull --rebase --autostash origin $1; }; f"
prepare = "!f() { git pull --rebase=interactive --no-autostash origin $1; }; f"
review = "!f() { git f; git co pr/$1; git reset HEAD^; }; f"
freview = "!git reset --hard; git co -"
gonelist = "!f() { git branch -vv | awk '/: gone]/{print $1}'; }; f"
goneremove = "!f() { git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D; }; f"
dangling = "!f() { gitk --all $( git fsck --no-reflog | awk '/dangling commit/{print $3}'); }; f"
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
theirs = "!f() { git checkout --theirs $@ && git add $@; }; f"
af = !git add $(fzf -m)
serve = daemon --verbose --export-all --base-path=.git --reuseaddr --strict-paths .git/
cleano = clean *.orig -f
lgfrom = "!f() { echo $@; echo $1; git log --since=\"$@\"; }; f"
effortfrom = "!f() { git log --since \"$1\" --pretty=format: --name-only -p -- ':(exclude)*.csproj' ':(exclude)src/qa' ':(exclude)src/qaCore' | sort | uniq -c | sort -rg | head -20; }; f"
recent = !git for-each-ref --sort=-committerdate --format='%(refname:short)' refs/heads/
conflicts = diff --name-only --diff-filter=U
releasediff = "!f() { git diff -w $1..$2 -- . ':!*[Tt]est*' ':!*.sln' ':!src/qa' ':!src/qaCore'; }; f"
nuke = "!git reset --hard origin/$(git branch-name); git clean -xdf;"
deltag = "!f() { git tag -d $@; git push -f origin :refs/tags/$@; }; f"
open="!f() { xdg-open $(git remote -v | head -1 | awk '{print $2}' | sed -e 's/[@:\\/]/ /g' | awk '{print \"https://\"$2\"/\"$3\"/\"$4}' | sed \"s/\\.git/\\/tree\\/$(git branch-name | sed 's,/,\\\\/,g')/g\"); }; f"
[color]
ui = auto
[user]
name = Stephen Kalpin
email = skalpin@gmail.com
[commit]
template = ~/.gitcommittemplate.txt
[core]
ignorecase = false
editor = \"C:\\tools\\vim\\vim82\\vim.exe\"
#editor = vim
autocrlf = true
safecrlf = warn
commitGraph = true
[diff]
tool = vsdiffmerge
guitool = kdiff3
[difftool]
prompt = false
[difftool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$LOCAL\" \"$REMOTE\" //t
keepBackup = false
[merge]
tool = kdiff3
[mergetool]
keepBackup = true
keepTemporaries = true
writeToTemp = true
prompt = false
[mergetool "kdiff3"]
keepBackup = true
keepTemporaries = true
path = C:/Program Files/KDiff3/kdiff3.exe
[mergetool "vscode"]
cmd = code --wait $MERGED
[mergetool "meld"]
cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\"
trustexitcode = true
[mergetool "vsdiffmerge"]
cmd = \"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\IDE\\vsdiffmerge.exe\" \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\" //m
trustexitcode = true
keepbackup = false
[color "diff"]
old = red strike
new = green italic
[winUpdater]
recentlySeenVersion = 2.21.0.windows.1
[remote "origin"]
fetch = +refs/pull/*/merge:refs/remotes/origin/pr/*
[rerere]
enabled = true
[difftool "kdiff3"]
path = C:/Program Files/KDiff3/kdiff3.exe
[pull]
rebase = false
[fetch]
prune = false
[rebase]
autoStash = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment