Reputation: 40982
I have repo
wrapper and about dozen different git repositories in it.
I would like to have one patch which I can apply/use later in the following manner:
I would like to perform this commands on all the changed submodules:
git checkout -b all_sub_branch
git commit -a all_submodules
git format-patch all_submodules aaa.patch
git apply aaa.patch
Upvotes: 1
Views: 154
Reputation: 1324606
Plain vanilla git answer (using submodules):
This kind of process done for each submodule could be initiated with:
git submodule foreach [--recursive] ...
With '...' referring to a git alias which would include all your commands.
From git submodule
man page:
foreach
Evaluates an arbitrary shell command in each checked out submodule.
The command has access to the variables$name
,$path
,$sha1
and$toplevel
:
$name
is the name of the relevant submodule section in.gitmodules
,$path
is the name of the submodule directory relative to the superproject,$sha1
is the commit as recorded in the superproject, and$toplevel
is the absolute path to the top-level of the superproject.Any submodules defined in the superproject but not checked out are ignored by this command.
Unless given--quiet
,foreach
prints the name of each submodule before evaluating the command.
If--recursive
is given, submodules are traversed recursively (i.e. the given shell command is evaluated in nested submodules as well).
The issue is that the android repo
wrapper command does what git submodule does in its own unique way.
So an equivalent of git submodule foreach
might be: repo forall
, e.g.:
repo forall -c 'git status'
Upvotes: 1