#!/bin/sh branch=$(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||') remote_branch=$(git branch -r | grep "origin/${branch}") test -z "${remote_branch}" && ( git push origin "${branch}" ) origin=$(git config --get "branch.${branch}.remote") test -z "${origin}" && ( git config --add "branch.${branch}.remote" origin ) merge=$(git config --get "branch.${branch}.merge") test -z "${merge}" && ( git config --add "branch.${branch}.merge" "refs/heads/${branch}" )