【发布时间】:2015-12-22 14:56:11
【问题描述】:
我在 Git 中看到一个奇怪的合并失败,在“压缩”合并到主控之后。
我创建了一个tiny GitHub repo 来重现该问题。
本质上,流程如下:
- 我创建了两个分支。
- 在一个分支中,我做了twocommits。
- 我将这些提交合并到第二个分支中。
- 我
merge --squash'd these commits into master。 - 我deleted a file directly on the master branch。
- 然后我merged the changes in master back into the original branch。
- 这就是问题发生的地方。此合并对分支产生无更改。在 master 上删除的文件仍然存在。
- 我将这个最新分支上的所有内容都拉到了第二个分支中。
- 我开了一个pull request来证明把第二个分支合并到master会重新引入之前删除的文件。
这里发生了什么?为什么从 master 合并回分支不包括直接对 master 分支所做的更改?这是错误还是使用错误?
【问题讨论】: