我们在我们的应用程序中使用 Qooxdoo 框架。现在,它的副本存储在我们的 Git 存储库的根文件夹“qooxdoo”中。我们已决定将其替换为直接指向 GitHub Qooxdoo 存储库的子模块,以便我们将来可以更轻松地 checkout 新版本。
我基于 master 为这些更改创建了分支,称为 qooxdoo-update。完全删除旧文件夹并为 qooxdoo 添加子模块。
git rm -r qooxdoo
git submodule add git://github.com/qooxdoo/qooxdoo.git qooxdoo
到目前为止,这工作得很好。然而,当我想将 master merge 到这个分支以保持更新直到其他开发人员可以再次测试他们的代码时,问题就出现了。
当我还在 qooxdoo-update 分支时,我发出命令:
git merge origin/master
CONFLICT (file/directory): There is a directory with name qooxdoo in origin/master. Adding qooxdoo as qooxdoo~HEAD
然后...
git status
Unmerged paths: (use "git add/rm ..." as appropriate to mark resolution)added by us: qooxdoo
正在运行...
git rm qooxdoo
qooxdoo: needs merge
rm 'qooxdoo'
Unlink of file 'qooxdoo' failed. Should I try again? (y/n)
或者...
git add qooxdoo
error: unable to index file qooxdoo
fatal: updating files failed
所以我不太确定如何解决该冲突以成功完成 merge 。
最佳答案
如果你想回到你的文件/目录的最新版本,执行:
git reset HEAD qooxdoo
应该可以。
关于切换到子模块时 merge Git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13760150/