feat: more git aliases

This commit is contained in:
2018-05-31 16:29:03 -07:00
parent 24517faffc
commit c253b61fb0
2 changed files with 11 additions and 0 deletions

View File

@@ -33,15 +33,18 @@
bsync = "!source ~/.githelpers && update_branch"
bp = !git backport
backport = "!source ~/.githelpers && backport_pr"
track = "!source ~/.githelpers && track_remote"
todo = grep --heading --break --ignore-case -e ' FIX: *' -e ' TODO: *'
pr = "!source ~/.githelpers && get_pr"
prd = "!source ~/.githelpers && del_pr"
brc = "!source ~/.githelpers && clean_branches"
lbr = for-each-ref --sort='-committerdate:iso8601' --format=' %(committerdate:iso8601)%09%(refname)' refs/heads
[merge]
tool = vimdiff
ff = true
[push]
default = current
followTags = true
[branch]
autosetuprebase = always

View File

@@ -124,3 +124,11 @@ backport_pr() {
# switch back if we didn't start in the target branch
[ "$THISBRANCH" != "$BRANCH" ] && git checkout -
}
track_remote() {
REMOTE=$1
: ${REMOTE:="origin"}
BRANCH=$2
[ -z "$BRANCH" ] && BRANCH=`git rev-parse --abbrev-ref HEAD`
git branch --set-upstream-to=${REMOTE}/${BRANCH} ${BRANCH}
}