#!/bin/sh set -eu STR="$(cat)" URL="$(echo "$STR" | sed -n -e '/^are available in the Git repository at:/,+2 { s/[[:space:]]\+// s/\(=[[:digit:]]\{2\}\)\+$// /^\(http\|git\)/p }')" END="$(echo "$STR" | awk '/^for you to fetch changes up to / { print $NF }' | sed -e 's/[=:]*$//')" git fetch "$URL" "$END" git checkout -B _4review FETCH_HEAD