#!/bin/bash

pullremote=${1?Need source remote}
branch=${2:-master}
pushremote=${3:-origin}

set -e
origbranch=$(git rev-parse --abbrev-ref HEAD)
git checkout "$branch"
git pull --ff-only "$pullremote" "$branch"
git push "$pushremote" "$branch"
git checkout "$origbranch"

