I'm trying to figure out how I can download a particular tag of a Git repository - it's one version behind the current version.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
But the version name is "Tagged release 1.1.5
" according the site.
I tried a command like this (with names changed):
git clone http://git.abc.net/git/abc.git my_abc
And I did get something - a directory, a bunch of subdirectories, etc.
If it's the whole repository, how do I get at the version I'm seeking? If not, how do I download that particular version?
If your tags are sortable using the linux
sort
command, use this:eg. if
git tag
returns:git tag | sort -n | tail -1
will output:git tag | sort -n | tail -2 | head -1
will output:(because you asked for the second most recent tag)
to checkout the tag, first clone the repo, then type:
..or whatever tag you need.
Use the
--single-branch
switch (available as of Git 1.7.10). The syntax is:For example:
The benefit: Git will receive objects and (need to) resolve deltas for the specified branch/tag only - while checking out the exact same amount of files! Depending on the source repository, this will save you a lot of disk space. (Plus, it'll be much quicker.)
try:
will give you the whole repository.
After the clone, you can list the tags with
$ git tag -l
and then checkout a specific tag:Even better, checkout and create a branch (otherwise you will be on a branch named after the revision number of tag):
first fetch all the tags in that specific remote
or just simply type
Then check for the available tags
then switch to that specific tag using below command
Hope this will helps you!
Clone with -b option also helps: git clone https://git01.codeplex.com/aspnetwebstack.git -b v2.0
The following post uses the above option to download asp.net mvc: http://vijayt.com/Post/Setting-up-aspnet-mvc-for-debugging-in-your-system