Skip to content

Instantly share code, notes, and snippets.

@hilen
Last active July 23, 2018 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hilen/644432e1af4fba5d9301c3c68689e4b1 to your computer and use it in GitHub Desktop.
Save hilen/644432e1af4fba5d9301c3c68689e4b1 to your computer and use it in GitHub Desktop.
[user]
name = Hilen
email = xx
[core]
excludesfile = /Users/hilenlai/.gitignore_global
[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 = matching
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[diff]
tool = Kaleidoscope
[difftool]
prompt = false
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustExitCode = true
[mergetool]
prompt = false
[merge]
tool = Kaleidoscope
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[alias]
# [b]ranch [a]ll (show all branches)
ba = branch -a
# show the commits since 5am
today = log --since=5am
# git [c]heck[o]ut
co = checkout
# git [st]atus
st = status
# git [c]ommi[t]
ct = commit
# git [br]anch
br = branch
# git [cl]one
cl = clone
# show last commit
last = log -1 HEAD
# git [c]herry-[p]ick
cp = cherry-pick
# git [p]ush [o]rigin [m]aster
pom = push origin master
# git [r]emote [a]dd [o]rigin
rem = remote add origin
d = diff --color-words
# [amend] commit
amend = commit --amend
# fetch all the remote branch
fab = "!git branch -a | for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do git branch --track ${branch#remotes/origin/} $branch; done"
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %C(green)%ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short --graph
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --oneline --decorate --date=relative
# list branches sorted by last modified
bt = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list all aliases
la = "!git config -l | grep alias | cut -c 7-"
# sync
sync = "!f(){ local branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e \"s/* \\(.*\\)/\\1/\"`; git pull origin $branch && git push origin $branch; }; f"
ours = "!f() { git checkout --ours $@ && git add $@; }; f"
# [up]date repository by saving uncommited changes to stash, pulling new ones and popping stashed changes
up = !git stash save && git pull --rebase && git stash pop && echo 'Success!'
update = !git stash save && git pull --rebase && git stash pop && echo 'Success!'
# git[k]
k = !gitk &
# git[k] on [a]ll branches
ka = !gitk --all &
# start git [ui] programs
ui = !git ka && git g &
ignore = update-index --assume-unchanged
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
reference:
https://gist.github.com/johnmetta/5470977
https://gist.github.com/VonC/972690
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment