I\'ve been wondering whether there is a good \"git export\" solution that creates a copy of a tree without the .git
repository directory. There are at least thr
This will copy the files in a range of commits (C to G) to a tar file. Note: this will only get the files commited. Not the entire repository. Slightly modified from Here
Example Commit History
A --> B --> C --> D --> E --> F --> G --> H --> I
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT C~..G | xargs tar -rf myTarFile.tar
git-diff-tree Manual Page
-r --> recurse into sub-trees
--no-commit-id --> git diff-tree outputs a line with the commit ID when applicable. This flag suppressed the commit ID output.
--name-only --> Show only names of changed files.
--diff-filter=ACMRT --> Select only these files. See here for full list of files
C..G --> Files in this range of commits
C~ --> Include files from Commit C. Not just files since Commit C.
| xargs tar -rf myTarFile --> outputs to tar