I have a script which automatically creates a new branch with a name based on external information (JIRA ticket). I don't want to create the remote branch until I've committed and pushed some code, but I don't want to have to do "git push --set-upstream origin"
In other words, I want to set the upstream before I push.
git checkout -b mybranch
git <do-something-to-prepare origin/mybranch without talking to origin>
<do work>
git commit -a -m "Made my changes."
git push
I've tried:
git branch --set-upstream-to=origin/mynewbranch
This results in:
error: the requested upstream branch 'origin/mynewbranch' does not exist.
Is there any way to do this?