Skip to content

Instantly share code, notes, and snippets.

@jonespm
Last active August 29, 2015 14:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonespm/21235befabd715bce135 to your computer and use it in GitHub Desktop.
Save jonespm/21235befabd715bce135 to your computer and use it in GitHub Desktop.
Merge from github
gitmerge() {
#Commands this needs
CURL=`which -p curl`
GREP=`which -p grep`
AWK=`which -p awk`
TR=`which -p tr`
UNIQ=`which -p uniq`
tmpfile=$(tempfile)
if [ "$1" ]; then
command $CURL -s https://github.com/sakaiproject/sakai/pull/$1.patch > $tmpfile
patch -p1 < $tmpfile
if [ "$?" = "0" ]; then
tool=`$GREP "+++" $tmpfile | $AWK -F/ {'print \$2'}` | $UNIQ | $TR '\n' ','
echo "Patch succeeded to $tool, you can commit!"
else
echo "There was some failure patching, please check the output above"
fi
rm $tmpfile
else
echo "You need to specify as a parameter which pull request to merge. For example, gitmerge 122. This should be run at the top level directory."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment