Skip to content

Instantly share code, notes, and snippets.

@timcharper
Created November 30, 2008 07:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timcharper/30398 to your computer and use it in GitHub Desktop.
Save timcharper/30398 to your computer and use it in GitHub Desktop.
#!/bin/bash
branch_name=$(sed 's|ref: refs/heads/||' .git/HEAD)
remote_name=${1:-origin}
remote_branch=${2:-$branch_name}
if [ "$branch_name" == "$(cat .git/HEAD)" ]; then
echo "You're not on a branch"
exit 1
fi
git config branch.$branch_name.remote $remote_name
git config branch.$branch_name.merge $remote_branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment