Do a "git export" (like "svn export")? -


i've been wondering whether there "git export" solution creates copy of tree without .git repository directory. there @ least 3 methods know of:

  1. git clone followed removing .git repository directory.
  2. git checkout-index alludes functionality starts "just read desired tree index..." i'm not entirely sure how do.
  3. git-export third party script git clone temporary location followed rsync --exclude='.git' final destination.

none of these solutions strike me being satisfactory. closest 1 svn export might option 1, because both require target directory empty first. option 2 seems better, assuming can figure out means read tree index.

probably simplest way achieve git archive. if need expanded tree can this.

git archive master | tar -x -c /somewhere/else 

most of time need 'export' git, want compressed archive in case this.

git archive master | bzip2 >source-tree.tar.bz2 

zip archive:

git archive --format zip --output /full/path/to/zipfile.zip master  

git archive more details, it's quite flexible.


note: if interested in exporting index, command is

git checkout-index -a -f --prefix=/destination/path/ 

(see greg's answer more details)


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -