From d0cded4a112faf32fd448906b5709725d54f63c7 Mon Sep 17 00:00:00 2001 From: Paul Redmond Date: Sat, 22 Dec 2012 22:04:03 -0700 Subject: [PATCH] Add prfetch and prmerge functions. Provie a basic Pull Request review and merging workflow. More can be read about this particular workflow at http://derickrethans.nl/managing-prs-for-php-mongo.html --- plugins/github/github.plugin.zsh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 598b059c1..c9b4b8ba4 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -67,5 +67,37 @@ exist_gh() { # [DIRECTORY] git push -u origin master } +# +# Provides a review workflow for pull requests. Best used with `prmerge` when ready to merge. +# +# Example - checks out the Pull Request 1 and rebases branch against master: +# `prfetch master 1` +# ... Check it out, test, etc. +# `prmerge master 1` +# Merges the Pull request, creates a reference to it, then pushes to the remote. +# +# @link http://derickrethans.nl/managing-prs-for-php-mongo.html +# +function prfetch() +{ + git checkout $1 + git fetch origin pull/$2/head:pr/$2 + git checkout pr/$2 + git rebase $1 +} + +# +# Merge a Pull Request that has been reviewed using `prfetch` and push. +# Example - Merge PR #1 into master and reference the PR in the merge: +# `prmerge master 1` +# +function prmerge() +{ + git checkout $1 + git merge --no-ff -m "Merged pull request #$2" pr/$2 + git branch -D pr/$2 + git push +} + # End Functions #############################################################