且构网

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

git合并分支在裸仓库中

更新时间:2023-02-14 21:55:13

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.