How do you create a remote Git branch?

后端 未结 23 2256
感情败类
感情败类 2020-11-22 13:31

I created a local branch which I want to \'push\' upstream. There is a similar question here on Stack Overflow on how to track a newly created remote branch.

Howeve

23条回答
  •  再見小時候
    2020-11-22 14:16

    Just wanted to add that while:

    git checkout -b {branchName}
    

    Creates a new branch, it also checks out that branch / makes it your current branch. If, for some reason, all you want to do is snap off a branch but not make it your current branch, then you would use the following command:

    git branch {branchName}
    

    In the first command, "checkout" makes said branch your current branch, and the "-b" means: this branch doesn't exist yet, so make it for me.

提交回复
热议问题