There is no exact svn export
equivalent command for git? Really?
Beware: this is not a duplicate question. That is, I already know and have
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.)
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.
For your I still don't know what the heck this is: git clone --bare
will clone the repository without a working copy. This is usually done on a central repository so as to minimise disk space usage.
Bruno / King Crunch have the best answer. Although you could use git bash / cygwin to allow you to pipe if you need a one-liner.
This is a rather old questions, nevertheless I didn't find an "obvious solution" in my opinion. After some research of the git documentation I found:
git archive --format=tar --remote ... | tar xf -
This will receive the contents even from a remote repository and write a tar archive to stdout. The tar command then will extract the contents and create it in your current directory.
If you like to do that from a local repository (which was explicitly not the desired request in the question), then
git archive --format=tar ... | ( cd /your/path && tar xf - )
will do the trick for you. The first approach works on Windows command prompt as well, if you have tar installed. The latter most probably does not and may overwrite your directory.
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
From https://stackoverflow.com/a/160719/43597
git checkout-index -a -f --prefix=/destination/path/