子模块中的 Git 合并冲突。我只想提交他们的版本。如何?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9505124/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git Merge conflict in submodule. I just want to commit with their version. How?
提问by JZ.
Basically I have read the git merge conflicts guide, and I'm not sure it directly addresses my situation. I have a conflict in submodules, and I just want to go with their version which I understand is git diff -3 app/bundles
How do I just go with there version of the submodule, resolve the conflict and commit?
基本上我已经阅读了 git 合并冲突指南,我不确定它是否直接解决了我的情况。我在子模块中有冲突,我只想使用他们的版本,我理解的是git diff -3 app/bundles
如何使用子模块的版本,解决冲突并提交?
~/projects/sms/admin(rc)$ git diff
diff --cc app/bundles
index 999fd0a,ae6acdc..0000000
--- a/app/bundles
+++ b/app/bundles
~/projects/sms/admin(rc)$ git diff -1 app/bundles
* Unmerged path app/bundles
diff --git a/app/bundles b/app/bundles
index b34a733..999fd0a 160000
--- a/app/bundles
+++ b/app/bundles
@@ -1 +1 @@
-Subproject commit b34a73375b4dfed6086d26d205ab5535acece053
+Subproject commit 999fd0a307e6d8d517ddf3dd6fab28a3ac0ec2c9
~/projects/sms/admin(rc)$ git diff -2 app/bundles
* Unmerged path app/bundles
~/projects/sms/admin(rc)$ git diff -3 app/bundles
* Unmerged path app/bundles
diff --git a/app/bundles b/app/bundles
index ae6acdc..999fd0a 160000
--- a/app/bundles
+++ b/app/bundles
@@ -1 +1 @@
-Subproject commit ae6acdce79748ffba68504512536abf2b2b2ddf0
+Subproject commit 999fd0a307e6d8d517ddf3dd6fab28a3ac0ec2c9
回答by iltempo
If I understood correctly you want to get rid of all your changes in the submodule? If so, cd into the submodule, reset and commit the change into the outer repo.
如果我理解正确,您想摆脱子模块中的所有更改吗?如果是这样,cd 进入子模块,重置并将更改提交到外部存储库中。
cd app/bundles
cd app/bundles
Please verify the hash again. All your changes will be lost.
请再次验证哈希。您所做的所有更改都将丢失。
git reset --hard ae6acdce79748ffba68504512536abf2b2b2ddf0
git reset --hard ae6acdce79748ffba68504512536abf2b2b2ddf0
cd ../..
cd ../..
git add app/bundles
git add app/bundles
git commit
git commit
Hope that is what you want to achieve.
希望这就是你想要达到的目标。