Do a “git export” (like “svn export”)?

后端 未结 30 2880
暖寄归人
暖寄归人 2020-11-21 22:33

I\'ve been wondering whether there is a good \"git export\" solution that creates a copy of a tree without the .git repository directory. There are at least thr

30条回答
  •  死守一世寂寞
    2020-11-21 22:41

    enter image description here

    A special case answer if the repository is hosted on GitHub.

    Just use svn export.

    As far as I know Github does not allow archive --remote. Although GitHub is svn compatible and they do have all git repos svn accessible so you could just use svn export like you normally would with a few adjustments to your GitHub url.

    For example to export an entire repository, notice how trunk in the URL replaces master (or whatever the project's HEAD branch is set to):

    svn export https://github.com/username/repo-name/trunk/
    

    And you can export a single file or even a certain path or folder:

    svn export https://github.com/username/repo-name/trunk/src/lib/folder
    

    Example with jQuery JavaScript Library

    The HEAD branch or master branch will be available using trunk:

    svn ls https://github.com/jquery/jquery/trunk
    

    The non-HEAD branches will be accessible under /branches/:

    svn ls https://github.com/jquery/jquery/branches/2.1-stable
    

    All tags under /tags/ in the same fashion:

    svn ls https://github.com/jquery/jquery/tags/2.1.3
    

提交回复
热议问题