Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: getting current revision only

Tags:

git

I'm setting up a script that downloads application source code from remote git repository and then launches the application build process. For obvious reasons I only need the current state (revision) of codebase to be downloaded - no need for history. Is there a way in git to achieve that? Cloning the whole repository is too painful.

like image 394
Axl Avatar asked Aug 10 '11 13:08

Axl


2 Answers

You can use git clone --depth 1 ... (see FAQ: How do I do a quick clone without history revisions?)

like image 153
Bruno Avatar answered Sep 27 '22 19:09

Bruno


You may try the --depth=1 parameter of git checkout:

git clone --depth=1 git://somehost/somerepo.git

alternatively, if your remote host support, you can use git archive:

 git archive --format=tar --remote=git://somehost/somerepo.git master  | tar -xf -
like image 28
J-16 SDiZ Avatar answered Sep 27 '22 19:09

J-16 SDiZ