且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

git合并裸仓库中的分支

更新时间:2023-02-14 21:41:05

git checkout 检出一个分支到工作树中——如果没有工作树,你认为这应该如何工作?并且 git merge 和大多数其他命令不起作用,因为裸存储库中没有 HEAD.

git checkout checks out a branch into the working tree – how do you think this should have worked without a working tree? And git merge and most other commands don’t work, because there is no HEAD inside of a bare repository.

回答您的问题:您不在裸存储库中工作.裸存储库仅用于保存数据;如果您想使用它,请使用非裸的克隆.

To answer your question: You don’t work within the bare repository. A bare repository is only there to keep the data; if you want to work with it, use a clone which is not bare.

因此,从任何其他存储库中,您可以从裸存储库中提取、在本地合并并将更改推送回该存储库.顺便说一句,您应该从您的开发存储库中执行此操作.以便实时和测试存储库仅从其分支中提取.

So from any other repository, you pull from the bare repository, merge locally and push your changes back to it. You should do this from your development repository btw. so that the live and test repositories only pull from their branch.