So, let's say I messed up and ran git commit -a, accidentally committing a submodule change that I didn't want (probably because I ran git pull and forgot to run git submodule update afterwards). I want to get rid of this change. Is there a one-liner I can use to do this?
The way I do this today, is:
- I run git showto figure out what the old hash was
- I cdinto the submodule, and I rungit reset --hard OLD_HASH
- Go back to parent directory and git commit --amend -a
This is too many steps. Is there really nothing shorter?
NB: This question is different from How do I revert my changes to a git submodule? where the user accidentally made actual changes to files in the submodule. In this case, no files were edited in the submodule; I just updated the commit pointer in the wrong direction.
 
     
    