DarVar
DarVar

Reputation: 18144

Order of git submodule foreach

Is there anyway to tell git submodule foreach to run in the submodule order specified in the .gitmodules? It seems to run alphabetically.

I want to the foreach command to run in th same order the submodules were added.

Upvotes: 5

Views: 656

Answers (1)

Arnaud B.
Arnaud B.

Reputation: 151

It seems there is no solution using git but a simple line of bash makes the job:

You extract the list of submodules with sed, then you read it line by line and execute what you want.

cat .gitmodules | sed -n 's/.*path = //p' | { while read project; do  everything you want execute with each $project; done; }

It respects the order that was in your gitmodules file

Upvotes: 2

Related Questions