Skip to content

Commit

Permalink
Usable for any repo having "origin" and "upstream"
Browse files Browse the repository at this point in the history
  • Loading branch information
rhowardiv committed Dec 5, 2012
1 parent 1aca74f commit 10e8d9f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions guppy
@@ -1,19 +1,18 @@
#!/bin/bash
# Pull fresh code from upstream master, push to origin master

CHECK_UPSTREAM=$(git remote -v | grep '^upstream\>.\+SnapInteractive/AYI\>')
if [ -z "$CHECK_UPSTREAM" ]; then
echo "You need to be in a git repo with an \"upstream\" remote for SnapInteractive/AYI!"
UPSTREAM=$(git remote -v | grep '^upstream\>.\+(fetch)$')
if [ -z "$UPSTREAM" ]; then
echo "You need to be in a git repo with a fetchable \"upstream\" remote!"
exit 1
fi

CHECK_ORIGIN=$(git remote -v | grep '^origin.\+(push)$')
if [ -z "$CHECK_ORIGIN" ]; then
ORIGIN=$(git remote -v | grep '^origin\>.\+(push)$')
if [ -z "$ORIGIN" ]; then
echo "You need to be in a git repo with a pushable \"origin\" remote!"
exit 1
fi


on_exit () {
if [ -n "$ON_BRANCH" ]; then
echo "Switching back to $ON_BRANCH..."
Expand Down Expand Up @@ -49,12 +48,11 @@ fi
# Now we're on master in a clean state; push and pull away

git pull --ff-only upstream master
git submodule update

if [ $? -ne 0 ]; then
echo "Could not pull cleanly into your master branch... you will need to manually merge changes from upstream."
exit 1
fi

git submodule update
git push origin master

0 comments on commit 10e8d9f

Please sign in to comment.