Created
May 29, 2019 02:26
-
-
Save lorne-luo/e106b32489b768d3e02f36bdd6966c5d to your computer and use it in GitHub Desktop.
gitconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Lorne | |
email = [email protected] | |
[alias] | |
# BASIC | |
cl = clone | |
ci = commit -m | |
mg = merge | |
st = status | |
co = checkout | |
cb = checkout -b | |
ca = commit --amend | |
rb = rebase | |
fe = fetch --all | |
up = remote update | |
di = diff --color | |
mb = merge-base | |
rmc = rm --cached | |
rv = remote -v | |
pick = cherry-pick | |
unstage = reset HEAD | |
all = add --all | |
# BRANCH | |
br = branch --color | |
ba = branch --color --all | |
# track same name branch from remote to local | |
tr = !sh -c 'test ! -z $1 && git branch --set-upstream-to=origin/$1 $1 || echo "err: input remote branch name"' - | |
# remove branch remotely | |
rmb = push origin --delete | |
# reset --hard and stash if necessary | |
rh = !sh -c 'test ! -z $1 && (test -z \"`git status -uno -s`\" && git reset --hard $1 || (git stash && git reset --hard $1 && git pop))' - | |
# PULL | |
pl = pull | |
plt = fetch --tags # pull all tags from remote | |
# pull --rebase, stash if necessary | |
plr = !sh -c 'test -z \"`git status -uno -s`\" && git pull --rebase || (git stash && git pull --rebase && git pop)' - | |
# PUSH | |
ps = push origin HEAD | |
psf = push origin HEAD -f | |
# push to specified remote | |
psto = !sh -c 'git push ${1:-origin} HEAD' - | |
# push all tags to origin remote | |
pst = push origin --tags | |
# push HEAD to all remotes | |
pstoall = !sh -c 'git remote | xargs -L1 -I R git push R HEAD' | |
# push all branch to all remotes | |
psall = !sh -c 'git remote | xargs -L1 git push --all' | |
# TAG | |
v = !sh -c 'git ver $1' - | |
# get commit by tag name | |
tagc = rev-list -n 1 | |
# list all tags and messages | |
tags = tag --sort=v:refname --format='%(refname:strip=2) %(contents:lines=1) <%(*authordate:relative)>' | |
# list all version tag or get version by commit hash | |
ver = !sh -c 'test ! -z $1 && (git tag --list \"v*\" --sort=v:refname --format=\"%(tag) <%(*authordate:relative)> %(contents:lines=1)\" --contains $1 | head -1) || git tag -l \"v*\" --sort=v:refname --format=\"%(tag) <%(*authordate:relative)> %(contents:lines=1)\" $1' - | |
# delete tag from remote | |
rmtag = !sh -c 'test ! -z $1 && (git tag -d $1 && git push origin :refs/tags/$1) || echo "input tag name going to delete"' - | |
# STASH | |
apply = stash apply | |
save = stash save | |
pop = stash pop | |
list = stash list | |
# LOG | |
wc = whatchanged | |
last = log -1 | |
l = !sh -c 'git lg' | |
# customized log format | |
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit | |
# reverse logs | |
rlog = log --color --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --reverse | |
# log with files changed | |
logs = !sh -c 'git lg --name-status' | |
# OTHER | |
# contributors by name | |
contrib = shortlog --no-merges -s -n | |
# cotributors by email | |
author = shortlog --no-merges -s -n --email | |
# total commit count exlude merge commit | |
total = !sh -c 'git log --no-merges --pretty=format:"" | wc -l' - | |
# print all git alias | |
alias = config --get-regexp alias | |
[push] | |
default = matching | |
[core] | |
excludesfile = /Users/lorne.luo/.gitignore_global | |
editor = vim | |
[filter "hawser"] | |
clean = git hawser clean %f | |
smudge = git hawser smudge %f | |
required = 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] | |
ui = auto | |
[color "branch"] | |
current = green reverse | |
local = green | |
remote = red | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold | |
new = green bold | |
[color "status"] | |
added = green | |
changed = blue | |
untracked = magenta | |
deleted = red | |
[filter "lfs"] | |
clean = git-lfs clean -- %f | |
smudge = git-lfs smudge -- %f | |
required = true | |
process = git-lfs filter-process | |
[commit] | |
template = /Users/lorne.luo/.stCommitMsg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment