I have a Git repo that has all the neccessary files for deb repo, the whole neccessary structure and files. Now I want to get those files from git repository (for example branch "new") to my webserver/deb repo.
What's the best way to do it? I used to use SVN and just used the SVN export command.
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
.