git reset HEAD "SUBMODULE 名字"
git commit
REF https://stackoverflow.com/questions/826715/how-do-i-manage-conflicts-with-git-submodules
分享人 admin @
2020-05-18 18:40:56
git reset HEAD "SUBMODULE 名字"
git commit
REF https://stackoverflow.com/questions/826715/how-do-i-manage-conflicts-with-git-submodules
https://stackoverflow.com/questions/26617838/how-to-resolve-git-submodule-conflict-if-submodule-is-not-initialized
What makes your situation kind of annoying is that git won't let you initialize an unmerged submodule, so the ordinary advice of just setting the submodule to the state you want within the submodule then running git add won't work. What you can do is to update the index directly, without going through the working tree.
One way to update the index is with git reset. If you know a commit in which the submodule is in a state you want, you can use that. For example, any of the following might be what you want:
The other option is to update the index directly using the plumbing command git update-index. To do that, you need to know that an object of type gitlink (i.e., directory entry in a parent repository that points to a submodule) is 0160000. There's no way to figure that out from first principles, but you can figure it out from
git ls-files -s
or the following reference (see "1110 (gitlink)" under 4-bit object type): https://github.com/gitster/git/blob/master/Documentation/technical/index-format.txtTo use that approach, figure out the hash you want to set the submodule to, then run, e.g.: