#!/bin/bash

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

set -e
origbranch=$(git rev-parse --abbrev-ref HEAD)
if [[ $origbranch == $branch ]]; then
	echo >&2 "Error: $branch can't be $origbranch"
	exit 1
fi
git checkout "$branch"
git pull --ff-only "$pullremote" "$branch"
git branch -d "$origbranch"

