Sudar
Sudar

Reputation: 19992

Include submodules as well in git checkout-index

Is there a way to copy files from the submodules as well when doing git checkout-index?

I already checked the documentation of git checkout-index but it makes no mention of submodules

Upvotes: 9

Views: 479

Answers (2)

Tarik
Tarik

Reputation: 118

You may want to try:

#install submodules
git submodule update --init --recursive

The recursive flag is not required but, per the man page:

If --recursive is specified, this command will recurse into the registered submodules, and update any nested submodules within.

Upvotes: 0

VonC
VonC

Reputation: 1324188

Neither checkout-index.c, t/t2006-checkout-index-basic.sh nor Documentation/git-checkout-index.txt mention submodules.
That was confirmed/discussed in this issue (2010) or this one (2015-2016).

So (as commented) git submodule foreach remains the best option:

 git submodule foreach --recursive 'git checkout-index'

Upvotes: 4

Related Questions