After creating a new branch with git switch -c mybranch
you cant immediately push to a remote.
If you try to do that, git will yell at you, telling you you need to configure an upstream branch.
ie. tell git what remote branch you want to push to from this local one.
To automatically infer the upstram branch without the manual step, configure push.default
. checkout the official docs to learn more.
When you do a git push
now, git will automatically push to a remote with exactly the same name as your local branch.