Exact `svn export` equivalent command for git?

The question "how can I do a svn-style 'export' with git?" is like asking "How can I change the tires on my basketball?". You can't, but that's not the basketball's fault. Yes it is rubber and full of air, but the similarity ends there.

You only need "export" with svn because it pollutes every single subdirectory with a .svn directory. Git doesn't do that, so you really don't need it. A clone IS an export, just with one directory at the root dir that all the repository business lives in.

The easiest thing is to clone the repo and then just delete the .git directory from the top level of the repo. Do that, and it's not a repo anymore, it's just a stand-alone directory of files.

Or, you know, ignore git all together and just use the files you cloned down. That works too.


From How do I do a quick clone without history revisions?:

git clone --depth 1 your_repo_url

Then, from the rmdir documentation:

rd /s /q .git

At some hostings like GitHub you can make exact svn export.

Example:

svn export https://github.com/GNOME/banshee/branches/master

Even partial! (some subpart of the repository)

Example:

svn export https://github.com/liferay/liferay-portal/branches/6.1.x/tools

For your own repository you should create some GitHub repository and add it as a remote:

git remote add github https://github.com/<user>/<repo>.git

then

git push github <branch>

Now you able to do a partial checkout as above.


Just get rid of the repository within the working copy.

git clone remote
rm -Rf .git

(On Windows, it's rd /s /q. Thanks for the hint by @Bruno.)