Question
Given an already pushed commit sha1
that contains a change to a submodule, and some other changes to other files, how do I revert only the change to the submodule, but keep the changes to the other files? (I.e., it is not an option to revert the whole commit.)
Attempt so far
I tried this, based on the answer in the related question:
git show some_commit_sha1 -- path/to/submodule | git apply -R
but obviously it does not work.
I would be surprised if it did, as the diff is just this:
git show some_commit_sha1 -- path/to/submodule
[...]
-Subproject commit abcdef12345....
+Subproject commit 98765432109....
(I guess git apply -R
can't do much with that.)
Related but not duplicated questions:
Revert changes to a file in a commit This is exactly what I want to do, however not with a file, but a submodule.
How do I revert my changes to a git submodule? This is for reverting "local" (not yet committed) changes
Git submodule revert commit Title seems to be exactly what I need, but then the question asks about something else (if I understand correctly it's about changing the content of the submodule on various branches)