How do you create a remote Git branch?

后端 未结 23 2250
感情败类
感情败类 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:09

    Create a new branch locally based on the current branch:

    git checkout -b newbranch
    

    Commit any changes as you normally would. Then, push it upstream:

    git push -u origin HEAD
    

    This is a shortcut to push the current branch to a branch of the same name on origin and track it so that you don't need to specify origin HEAD in the future.

提交回复
热议问题