How to create a branch in a bare repository in Git

后端 未结 3 1919
眼角桃花
眼角桃花 2021-02-04 00:55

I current have a bare repo thats acts as a central repo for my team. The bare repo currently only have a branch \"master\". How can I create more branches on the bare repo?

3条回答
  •  情书的邮戳
    2021-02-04 01:25

    Usually you don't create branches directly in the bare repository, but you push branches from one work repository to the bare

    git push origin myBranch
    

    Update: Worth to mention

    Like Paul Pladijs mentioned in the comments with

    git push origin localBranchName:remoteBranchName
    

    you push (and create, if not exists) your local branch to the remote with a different branch name, that your local one. And to make it complete with

    git push origin :remoteBranchName
    

    you delete a remote branch.

提交回复
热议问题