git -submodules / repo – How to use commit and branch for a bunch of branches in separate modules?
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:
- How do I merge an existing git repository into an empty one and preserve the history?
- how to collect release version in lots of git repositories
- Netbeans git can't checkout local branch - Conflicts during checkout
- SVN: Moving repository trunk to another's branch (with history)
- Git pushing unfinished changes to repo
- Eclipse Git nested repositories not found
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
One Solution collect form web for “git -submodules / repo – How to use commit and branch for a bunch of branches in separate modules?”
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.
git submodule man page:
Evaluates an arbitrary shell command in each checked out submodule.
The command has access to the variables
$nameis the name of the relevant submodule section in
$pathis the name of the submodule directory relative to the superproject,
$sha1is the commit as recorded in the superproject, and
$toplevelis 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.
foreachprints the name of each submodule before evaluating the command.
--recursiveis 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'