问题描述
为什么我不能merge
进入裸仓库?裸仓库没有HEAD
或有效树.在配置文件中,我们可以看到bare=true
.
Why can’t I merge
into a bare repo? Bare repos don’t have a HEAD
or a working tree. In the config file we can see bare=true
.
您也不能在裸仓库中pull
(因为pull = fetch& merge and merge不起作用).但是,您可以进行裸仓库交易-为什么?据我所知,push
也包含合并,但是在这种情况下,我们可以做到很好.
You also can’t pull
in a bare repo (because pull = fetch & merge and merge doesn't work). However, you can push to a bare repo – why? As far as I know, push
also contains a merge, but in this case we can do it well.
因此,问题可能是"git merge如何工作?".为什么需要HEAD
?合并时在做什么?
So, the question could be "how does git merge work?". Why does it need a HEAD
? What is it doing when merging?
推荐答案
,推送会进行快速合并或强制更新,这只会将引用/分支指针移至其他提交.
As Chronial points out, pushing does fast-forward merges or forced updates, which just moves references/branch pointers to a different commit.
在实际的非快进合并中,如果遇到需要解决的冲突,则需要一个工作副本.之前其他Stack Overflow用户都提到过它.例如,请参见此答案(重点是我的):
In an actual non-fast-forward merge, you need a working copy in the case that you get conflicts that you need to resolve. It's been mentioned before by other Stack Overflow users; for example, see this answer (emphasis mine):
这篇关于您为什么不能合并在裸露的git repo中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!