How to do a "git export" (like "svn export")
        Posted  
        
            by Greg Hewgill
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Greg Hewgill
        
        
        
        Published on 2008-10-02T02:21:33Z
        Indexed on 
            2010/03/19
            16:21 UTC
        
        
        Read the original article
        Hit count: 731
        
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 three methods I know of:
- git clonefollowed by removing the- .gitrepository directory.
- git checkout-indexalludes to this functionality but starts with "Just read the desired tree into the index..." which I'm not entirely sure how to do.
- git-exportis a third party script that essentially does a- git cloneinto a temporary location followed by- rsync --exclude='.git'into the final destination.
None of these solutions really strike me as being satisfactory. The closest one to svn export might be option 1, because both those require the target directory to be empty first. But option 2 seems even better, assuming I can figure out what it means to read a tree into the index.
© Stack Overflow or respective owner