Reputation: 3044
If I'm working on a branch A and git checkout master
and then make a new branch B with git branch B
, will this new branch automatically make a tracked branch on the remote repo? Thus, whenever I push from this branch, it will push to a new remote branch 'B' on the remote repo.
Upvotes: 0
Views: 47
Reputation: 106430
No tracking branch is ever created automatically; it is a result of a direct user instruction.
I should point out that there are differences between creating a remote branch and creating a remote branch which is tracked locally. You can create a remote branch by pushing the branch you created right away, but that won't cause it to be tracked. You create a tracked branch one of two ways:
After the branch has been pushed and you are on the local branch you wish to track it with
git branch --set-upstream-to=origin/branchname
# or
git branch -u origin/branchname
Before the branch has been pushed and you are on the branch you'd like to push
git push -u origin branchname
For more nuance into the above two commands, this particular question provides a lot more detail.
Upvotes: 2
Reputation: 5215
The remote branch is created when you push, not when you create the local branch.
Upvotes: 1