Skip to content

Instantly share code, notes, and snippets.

@dracorp
Created December 16, 2021 18:34
Show Gist options
  • Save dracorp/9918dd7b01aeb7a08df8528fb9f1cae1 to your computer and use it in GitHub Desktop.
Save dracorp/9918dd7b01aeb7a08df8528fb9f1cae1 to your computer and use it in GitHub Desktop.
[user]
gui = gitk
[push]
default = current
;default = matching
;default = simple
[rebase]
autosquash = false
[core]
autocrlf = false
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
editor = vim
# attributesfile = # see default value ~/.config/git/attributes
# excludesfile = # see default value ~/.config/git/ignore
pager = less -FRSX
excludesfile = ~/.config/git/ignore
[color]
diff = auto
status = auto
branch = auto
ui = true
[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
[merge]
ff = false
tool = diffconflicts
summary = true
[mergetool "threesome"]
cmd = "vim -f $BASE $LOCAL $REMOTE $MERGED -c 'ThreesomeInit'"
trustExitCode = true
[mergetool "diffconflicts"]
cmd = vim -c DiffConflicts \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"
trustExitCode = true
[mergetool]
keepBackup = true
[diff]
tool = vimdiff
renames = copy
submodule = diff
# git config --global diff.submodule log
# git config --global diff.submodule short
# git config --global diff.submodule diff
# https://www.jvt.me/posts/2018/05/04/git-submodule-diff-formats/
[diff "vimdiff"]
cmd = "vim -d" "$LOCAL" "$REMOTE"
[branch]
autosetuprebase = always
[tig "color"]
# white, black, green, magenta, blue, cyan, yellow, red, default
# A strange looking cursor line
cursor = default default underline
# UI colors
title-blur = white blue
title-focus = white blue bold
date = cyan default
# View specific color
[tig "color.tree"]
[credential]
helper = osxkeychain
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
[http]
sslVerify = false
postBuffer = 157286400
[bash-it]
hide-status = 1
[commit]
gpgsign = false
template = ~/.config/git/stCommitMsg
[alias]
alias = config --get-regexp ^alias\\.
rv = !git remote -v
ro = !git-remote-open
au = add -u
aa = add --all :/
ap = add -u -p
b = browse
br = branch
ci = commit
amend = commit --amend --no-edit
co = checkout
cl = clone
d = diff
df = diff
dc = diff --cached
ds = diff --staged
dw = diff --color-words
changes=diff --name-status -r
diffstat=diff --stat -r
who = shortlog -s --
gitkconflict = !gitk --left-right HEAD...MERGE_HEAD
unstage = reset HEAD --
try = merge --no-commit --no-ff
changed = diff-tree -r --no-commit-id --name-only
; logs
l = log --pretty='format:%C(yellow)%h %C(blue)%ad %C(reset)%s%C(red)%d %C(green)%an%C(reset), %C(cyan)%ar' --date=short
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg3 = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg4 = log --graph --pretty="\"%h %d %s\"" --decorate=full --tags
lg5 = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
lg = !"git lg2"
lp = log -p
last = log -1 HEAD
llog = log --date=local
files = log --name-only
; show number of commits
wc = rev-list HEAD --count
count = rev-list HEAD --count
ssp = stash show -p
sl = stash list
# pull and update submodules
pull-modules = !git pull && git submodule update --init --recursive --depth 1
pull-all-branches = "!f(){ git branch --format='%(refname:short)' | xargs -I {} sh -c 'git checkout {}; git pull'; }; f"
s = status -s -b
st = status
sc = diff --name-only --diff-filter=U
sm = submodule
smu = submodule foreach git pull origin master
w = whatchanged --decorate
wp = whatchanged --decorate -p
wtf = "!git fetch --multiple production origin && git log production/master..origin/master"
diff-image = "!f() { cd -- \"${GIT_PREFIX:-.}\"; GIT_DIFF_IMAGE_ENABLED=1 git diff \"$@\"; }; f"
commitall = "!f(){ git add . && git commit -aqm \"$1\" && git push -q; }; f"
; Explicit is better than implicit. If we want to merge
; we should do so ourselves.
pull = pull --ff-only
g = "!f() { git grep -i \"$1\" $(git for-each-ref --format='%(refname)' refs/); }; f"
grep-refs = !sh -c 'git grep "$0" "$@" "$(git for-each-ref --format=\"%(refname)\"" refs/)'
[diff "image"]
command = ~/.basher/cellar/bin/git_diff_image
[cola]
spellcheck = false
[gui]
editor = vim
[help]
autocorrect = 1
[init]
defaultBranch = master
[pull]
ff = only
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[grep]
extendRegexp = true
lineNumber = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment