Skip to content

Instantly share code, notes, and snippets.

@fxchen
Created November 4, 2018 21:51
Show Gist options
  • Save fxchen/06fd962e4bbc684947dfb2bec195b2c3 to your computer and use it in GitHub Desktop.
Save fxchen/06fd962e4bbc684947dfb2bec195b2c3 to your computer and use it in GitHub Desktop.
Default gitconfig
[user]
name = Frank Chen
email = <REDACTED>
[color]
ui = true
branch = auto
diff = auto
interactive = auto
status = auto
[github]
user = fxchen
token = <REDACTED>
[core]
excludesfile = /Users/fchen/.gitignore_global
pager = less -FMRiX
[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
[push]
default = current
[branch]
autosetuprebase = always
[alias]
# Basics
s = status -sb
st = status -sb
ts = status -sb
cl = clone
ci = commit
br = branch
co = checkout
diff = diff --word-diff
d = !git diff --word-diff
ds = !git diff --word-diff --staged
dc = !git diff --word-diff --cached
cp = cherry-pick
unstage = reset HEAD --
alias = config --get-regexp ^alias\\.
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
diffstat = diff -w --ignore-space-at-eol --stat -r
personal = config --local user.email \"[email protected]\"
r = rebase
p = pull --rebase
f = fetch
# Logs
lg = log -n 25 --graph\n--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
lga = log --all -n 25 --graph\n--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
lgp = log --graph\n--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
lgap = log --all --graph\n--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
byme = !git lga --author='Frank'
# stash shortcuts
sl = stash list
sa = stash apply
ss = stash save
# Related to commits
logme = !USERNAME=$(git config user.name) && git log --author="\"$USERNAME\"" --since='2 weeks ago'
last-commit = diff HEAD^..HEAD
last-commit-files = diff HEAD^..HEAD --stat
incoming = log HEAD..origin/master --date=relative --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
outgoing = log origin/master..HEAD --date=relative --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order
# Resets
r = reset
r1 = reset HEAD^
r2 = reset HEAD^^
rh = reset --hard
rh1 = reset HEAD^ --hard
rh2 = reset HEAD^^ --hard
springcleaning = for-each-ref --sort=-committerdate --format='%(refname:short) %(committerdate:short)'
[filter "lfs"]
required = true
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
clean = git-lfs clean -- %f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment