Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clone a specific version of a git repository?

Tags:

git

symfony

I'm working with symfony2 and I want to backup my vendors in case github is not reachable.

How do I clone a specific Version of a repository?

I want to backup the repositories with help of the vendors-file.

the syntax is something like this:

[symfony]
    git=http://github.com/symfony/symfony.git
    version=v2.0.9

now how do I tell git to get that specific version? Is there a terminal-command like:

git clone --mirror http://github.com/symfony/symfony.git --version=v2.0.9

Thanks in Advance

like image 645
Senči Avatar asked Apr 24 '12 18:04

Senči


2 Answers

What I would do to tell git to use this exact version is:

git clone http://github.com/symfony/symfony.git
cd symfony

git checkout v2.0.9

One liner:

git clone http://github.com/symfony/symfony.git -b v2.0.9
like image 113
Matt Avatar answered Oct 05 '22 23:10

Matt


The following might get you there:

git clone --branch <branch> <repo>

If you are looking for a specific version, then first create a branch off that version from your working repository. Like such:

# In a local, working repository
git checkout -b v2.0.9-br v2.0.9
git push origin

# Now create your clone from v2.0.9-br

Note, I've assumed v2.0.9 is a version (tag), not a branch. If it is a branch, then just clone with the '--branch' option.

like image 35
GoZoner Avatar answered Oct 06 '22 00:10

GoZoner