-
Notifications
You must be signed in to change notification settings - Fork 87
Home
git-archive-all.sh
is a simple bash shell script that runs git-archive
in the current directory, then finds all git submodules beneath the current working directory and runs git-archive
for each of them, too. By default, the utility will then create one “super archive” of the entire directory hierarchy.
Most options available in git-archive
are supported, notably the --format
option. See below for details.
The following sections are a pseudo-manual. The most up-to-date information is always available by running
git-archive-all.sh --help
and asking the code, itself.
The simplest use of this script is:
cd $GIT_DIR; git-archive-all.sh
where $GIT_DIR
is your superproject’s root directory. This will create a single .tar
file in the current directory named after the current directory. That is, if your superproject directory is called “super” it creates a file called “super.tar”.
If you want your superproject and submodules to be archived in individual files, simply pass --separate
or -s
to the script.
cd $GIT_DIR; git-archive-all.sh --separate
This will create the aforementioned “super.tar” file. Assuming you have a submodule at the path dir1/sub1
, you will also see a file in the current directory called “dir1.sub1.tar”.
Since different submodules may be at different commits, git-archive-all.sh
always supposes you want the HEAD of the superproject and the currently checked out commit as reported by git-submodule status
of its submodules. That is, there is no provision to provide git-archive-all.sh
with a different tree-ish parameter to pass along to git-archive
. This might cause surprise if your submodule’s working copy is different than the superproject’s commit reference for it. To solve that confusion, simply run git-submodule update --init
before running git-archive-all.sh
.
git-archive-all.sh
is a wrapper around git-archive
, so it should go without saying that only formats which git-archive
understands are supported (but I’m saying it anyway).