如何在Git的裸仓库中创建分支 [英] How to create a branch in a bare repository in Git

查看:400
本文介绍了如何在Git的裸仓库中创建分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个裸露的仓库,可以作为我团队的中央仓库.裸仓库目前只有一个分支"master".如何在裸仓库上创建更多分支?

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?

推荐答案

通常,您不会在裸存储库中直接创建分支,而是将分支从一个工作存储库推入裸存储库

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

更新:值得一提

与评论中提到的Paul Pladijs一样

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

您删除远程分支.

这篇关于如何在Git的裸仓库中创建分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆