git submodules - how to undo git submodule update --init

Viewed 2687

I have a git project with several submodules within. Between now and a year ago several submodules have moved - even some of the same have been moved a directory level down. Another one moved from one URL to another and location location. Git does not take such changes kindly :)

When I have my git and have run git submodule update --init - then I cannot run

$ git checkout OLDSHA
fatal: not a git repository: sub/depdir/../../.git/modules/sub/depdir

or I get

fatal: could not get a repository handle for submodule 'sub/depdir'

If I clone the git from scratch, run git checkout OLDSHA - AND THEN git submodule update --init, no problems.

Then my question:

  • Is there a way to undo git submodule update --init which essentially brings me back to what I get after git clone PROJECT && cd project && git checkout OLDSHA

Note; this is NOT about getting rid of my submodules. The problem is to enable my e.g. to run git bisect across these changes more effetively without having to re-clone from scratch.

0 Answers
Related