Here is my usual workflow:
- create a new branch:
git checkout -b foo - convey some things
- do push:
git push - angry that push is not working (no upstream dialing)
- move the mouse to highlight git of the recommended command (still angry)
- click upstream tuning:
git push --set-upstream origin foo (anger subsides)
Instead of 4-6, I would like to do some work when creating a new branch locally (without having to make my branch open, so without clicking ), which kills steps 4. through 6. Is this possible?
Ideally, something like git checkout -b foo -t origin , which tells git that I plan to track a branch with the same name in origin .
What i tried
git checkout -b foo --set-upstream origin foo ~> error: unknown option 'set-upstream'
git checkout --track origin/foo ~> fatal: Cannot update paths and switch to branch 'foo' at the same time.
git checkout -b foo --track origin/foo ~> fatal: Cannot update paths and switch to branch 'foo' at the same time
git checkout -b foo --track ~> Branch foo set up to track local branch master.
git
Nicolai
source share