I want to use git archive anywhere in the repo and include the entire repo.
name@host:~/repo$ git archive HEAD -o /path/to/archive/repo.tar.gz
The above command will work fine ONLY when my working directory is the repo root. When I am working at the asset subdirectory:
name@host:~/repo/asset$ git archive HEAD -o /path/to/archive/repo.tar.gz
The tarball will contain the contents of the asset subdirectory, not the entire repo.
The official documentation of git-archive:
<path>Without an optional path parameter, all files and subdirectories of the current working directory are included in the archive. If one or more paths are specified, only these are included.
But this only works when I specify the absolute/relative path to the repo root. This is annoying because Git must be very well aware about where the repo root is, so I shouldn't need to tell it.
EDIT: It seems the <path> parameter is only useful for limiting what to include in the archive in the current working subdirectory. It doesn't help at all for breaking the subdirectory limitation.
Would there be a command that creates a tarball of the entire repo regardless of which subdirectory I happen to be working at within the repo?