Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Merge conflicts in submodule. How to commit with their version?

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?

~/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
like image 577
JZ. Avatar asked Dec 21 '22 01:12

JZ.


1 Answers

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 app/bundles

Please verify the hash again. All your changes will be lost.

git reset --hard ae6acdce79748ffba68504512536abf2b2b2ddf0

cd ../..

git add app/bundles

git commit

Hope that is what you want to achieve.

like image 141
iltempo Avatar answered Jan 30 '23 23:01

iltempo