Search code examples
gitsvnversion-control

Exact `svn export` equivalent command for git?


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 tested these commands:

  • git clone --depth 1 <- Still downloads the .git folder.
  • git checkout-init <- Doesn't work for a remote repo, it works with a working copy (so you need to clone first).
  • git archive <- This would be the perfect solution, because it has a --remote argument, but it only has 2 possible formats: tar or zip, so I would need to untar/unzip after downloading, and for that I need a pipe (|), but I'm on windows!! (not *n?x)
  • git clone --bare <- I still don't know what the heck this is, but it's not what I need.

Please enlighten me is there a real svn export replacement in git?


Solution

  • 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.

    UPDATE: Looks like this feature is getting discontinued.