There isn't a direct equivalent in Git of the svn export
command, so probably the easiest way is to make an archive and unpack it. git archive
makes a ZIP or tar archive containing just the contents of the repository without any of Git's metadata, so make one of those and unpack it:
git archive -o /tmp/repo.tar HEAD
cd /your/server/directory
tar -xf /tmp/repo.tar
rm /tmp/repo.tar
You can avoid the temporary file with the -C
option to tell tar
to change directory:
git archive --format tar HEAD | tar -C /your/server/directory -xf -
The -f -
tells tar
to take its input from stdin.
Perhaps one day Git will acquire the ability to archive to a file tree, like svn export
or hg archive --type files
.