edit Outdated, just use git push -u origin $BRANCHNAME
Use git publish-branch
from William's miscellaneous Git tools (gitorious repo and cloneWilliam's miscellaneous Git tools).
OK, no Ruby, so - ignoring the safeguards! - take the last three lines of the script and create a bash script, git-publish-branch
:
#!/bin/bash
REMOTE=$1 # Rewrite this to make it optional...
BRANCH=$2
# Uncomment the following line to create BRANCH locally first
#git checkout -b ${BRANCH}
git push ${ORIGIN} ${BRANCH}:refs/heads/${BRANCH} &&
git config branch.${BRANCH}.remote ${REMOTE} &&
git config branch.${BRANCH}.merge refs/heads/${BRANCH}
Then run git-publish-branch REMOTENAME BRANCHNAME
, where REMOTENAME is usually origin (you may modify the script to take origin as default, etc...)