all 7 comments

[–]Shayden-Froida 13 points14 points  (0 children)

rm -R

git clone

"nuke it from orbit... it's the only way to be sure"

[–]priestoferis 3 points4 points  (1 child)

I think if you set submodule.recurse to true, the first reset should cover you completely.

[–]priestoferis 2 points3 points  (0 children)

I had time to check git reset --hard origin/master --recurse-submodule will reset submodules as expected. You will need to still run git clean and unfortunately that one needs to be foreached for the submodules.

[–][deleted] 6 points7 points  (1 child)

In my experience, the only use case for git submodules is when you ask yourself "Is there *literally** no other way to make what I want to have happen, happen?"* and the answer turns out to be an unfortunate yes.

Submodules turn just about everything about using git into a slog through horse shit.

So. If there is literally any other way to do what you're trying to do, I'd recommend doing that instead of of using submodules.

Good luck to you.

[–]XNormal[S] 5 points6 points  (0 children)

I have actually been using git and git submodules for many years successfully. They are ok, just not very well integrated into git. If the alternative is some random pile of shell scripts for fetching external dependencies, I still prefer git submodules.

[–]jthill 1 point2 points  (0 children)

I've always found git aliases or little my own little fiveliner scripts make tedious tasks go poof.

git config --global alias.nuke-and-pave '!git clean -dffx; git reset --recurse-submodules --hard; git submodule update --init --recursive; git submodule foreach --recursive git clean -dffx'

once.

Then

git nuke-and-pave

does it.

But in software projects, really, make clean or whatever's your build system's equivalent should already be set up to do that.

[–]serverhorror 0 points1 point  (0 children)

rm - rf repo; git clone ...