Use git archive
; something like:
git archive --format=tar --remote=$REPO $BRANCH | tar xf -
This command gets only the source tree with no git metadata (i.e., no .git
subdirectory). It is also very fast. The command above writes the source code into the current directory; to write it into a subdirectory add the option --prefix=subdir/
.