/git-archive-all

git-archive with recursive submodule support

Primary LanguageShellMIT LicenseMIT

git-archive-all

Synopsis

git archive-all [--format=<fmt>] [--list] [--prefix=<prefix>/]
                [-o <file> | --output=<file>] [--worktree-attributes]
                [-v | --verbose] [--recursive | --no-recursive]
                [--fail-missing] [-0 | -1 | -2 | ... | -9 ]
                [--add-file=<file> ...] <tree-ish> [<path>...]

git archive-all works similar to git archive, but will also include files from submodules into the archive. This is not the only implementation of this particular feature, but it is the one that mimics git archive best. It uses the same command line arguments, and in the absense of submodules, it will behave identically. Basically, you can use it for all archiving purposes and need not think about the technicalities of submodules.

Requirements

git-archive-all requires GNU getopt and GNU tar. On MacOS, you may need to install gnu-getopt and gnu-tar with Homebrew, and make sure that your PATH is setup to prefer the Homebrew versions over the stock ones.

Installation

You can run make install to install git-archive-all and its manual page. By default, the Makefile will pick /usr/local as install prefix if run as root, and $HOME/.local otherwise. You can override that choice with make install prefix=/path/to/other/prefix.

The install script needs pod2man from the Perl distribution to generate the manual page.

Testing

git-archive-all comes with a small Bats test suite. You can run the test suite with ./test.bats if you have installed Bats, e.g. with sudo apt install bats.

Alternatives

If this script does not satisfy your needs, you may be interested in one of the following alternatives instead: