Skip to content


Charles Brossollet edited this page Oct 21, 2013 · 10 revisions
Clone this wiki locally 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.

How to use

The following sections are a pseudo-manual. The most up-to-date information is always available by running --help

and asking the code, itself.




The simplest use of this script is:

cd $GIT_DIR;

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; --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, 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 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 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).

Something went wrong with that request. Please try again.