Skip to content

Instantly share code, notes, and snippets.

@walish
Last active August 14, 2024 06:26
Show Gist options
  • Save walish/e19fcc503b98018e39dca20a70b21623 to your computer and use it in GitHub Desktop.
Save walish/e19fcc503b98018e39dca20a70b21623 to your computer and use it in GitHub Desktop.
[core]
excludesfile = ~/.gitignore
# excludesfile = ~/.gitignore_global
pager = less -FRSX
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
editor = nano
mergeoptions = --no-commit --no-ff
[mergetool]
keepBackup = true
[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
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = 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 = green
changed = red
untracked = cyan
[alias]
co = checkout
st = status
ci = commit
aa = add -A
br = branch
cam = commit -a --amend
sb = show-branch
branches = branch -a
# usage example: git w -n5
w = whatchanged
# add all changed (but not new) files to stage (index):
au = add -u
undo = reset --soft HEAD^
graph = log --graph --oneline --decorate
info = config --list
pop = !git stash apply && git stash clear
summary = log --oneline
tags = tag -n1 -l
exclude = !sh -c 'echo "$1" >> .git/info/exclude' -
dc = diff --cached
last = log -1 HEAD
lg = log --graph --decorate --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
tree = log --graph --decorate --pretty=format:'%C(magenta)%h%Creset -%C(red)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
today = diff --stat @{yesterday}..HEAD
# given a string for an author, try to figure out full name and email:
whois = !sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\
\" --author=\"$1\"' -
# given any git object, try to show it briefly
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# Search for a given string in all patches and print commit messages
# example: search for any commit that adds or removes string "foobar"
# git searchcommits foobar
# example: search commits for string "foobar" in directory src/lib
# git searchcommits foobar src/lib
# example: search commits for "foobar", print full diff of commit with 1 line context
# git searchcommits foobar --pickaxe-all -U1 src/lib
searchcommits = "!f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\""
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %
[push]
default = simple
[rerere]
enabled = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment