Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

copy a git repository without revisions (without .git and .gitingore) from a remote server

Tags:

git

How to copy a git repository directly form remote server without .git directory and .gitignore files?. In advance from a tag name or branch.

like image 938
gihan Avatar asked Apr 27 '12 09:04

gihan


1 Answers

You can use the command

git archive branchname

to archive files from a named tree. I.e. you can pass the output to tar to pack the files or filter files like .gitignore (.git will not be exported):

git archive branchname | tar -x -C c:\git-my-branch

Checkout out git help archive for more details.

The equivalent of svn export . otherpath inside an existing repo is

git archive branchname | (cd otherpath; tar x)

The equivalent of svn export url otherpath is

git archive --remote=url branchname | (cd otherpath; tar x)
like image 92
Sergey K. Avatar answered Nov 13 '22 23:11

Sergey K.