add aliases to sync with other remotes and checkout pull requests

This commit is contained in:
2014-07-18 15:33:54 -07:00
parent 8293e68365
commit da273eabd7
2 changed files with 16 additions and 0 deletions

View File

@@ -28,8 +28,10 @@
ra = !git r --all
l = "!source ~/.githelpers && pretty_git_log"
la = !git l --all
sync = "!source ~/.githelpers && sync_to_remote"
todo = grep --heading --break --ignore-case -e ' FIX: *' -e ' TODO: *'
pr = "!source ~/.githelpers && get_pr"
[merge]
tool = vimdiff
ff = false

View File

@@ -40,3 +40,17 @@ pretty_git_log() {
less -FXRS
}
sync_to_remote() {
REMOTE=$1
: ${REMOTE:="upstream"}
BRANCH=`git rev-parse --abbrev-ref HEAD`
git fetch upstream
git merge --ff-only ${REMOTE}/${BRANCH};
}
get_pr() {
REMOTE=$2
: ${REMOTE:="upstream"}
git fetch ${REMOTE} pull/${1}/head:pr/${1}
git checkout pr/${1}
}