1

Newbie at git, but I've been trying to figure this out for an hour. How do I clone a specific release from github?

I want these files: https://github.com/angular-ui/ui-grid.info/tree/gh-pages/release/3.1.1 but that URL does not work with clone, so I can't figure out how to get them.

I can clone this parent URL: https://github.com/angular-ui/ui-grid.info.git but that does not seem to have the files I want.

So how can I get that specific 3.1.1 release?

UPDATE: Issue solved. My question assumed that git allows you to clone a specific directory in the repo (and not have to also clone all the other directories you don't care about). I now realize git just doesn't support that; you apparently have to clone the entire repo and then just cd into the directory you want.

2
  • When you say want, what do you mean? For download or editing? Commented Feb 14, 2016 at 4:51
  • I mean downloading to my local copy. Commented Feb 14, 2016 at 14:01

2 Answers 2

1

Release v3.1.1 is essentially a tag. You can clone using that tag:

git clone --branch v3.1.1 https://github.com/angular-ui/ui-grid.info.git 

Or

git clone --branch v3.0.5 https://github.com/angular-ui/ui-grid.info.git 

To clone "Release 3.0.5"

See How to git clone a specific tag

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks, but no, that does not give the same files as shown on github.com/angular-ui/ui-grid.info/tree/gh-pages/release/3.1.1 That clone command is cloning a bunch of other files. How can I get those files exactly?
@user2543623 After cloning you checkout gh-pages branch at the commit that you want. How? Please search
@AseemBansal -- Thanks, but no, I already tried that and that isn't the right answer either. "git checkout gh-pages" still gives a different set of files than is shown on github.com/angular-ui/ui-grid.info/tree/gh-pages/release/3.1.1 Is there any way to get exactly those files?
@user2543623 What's the difference? The release is a folder inside it and you have to manually go there. What is the current commit hash that is checked out? stackoverflow.com/questions/949314/… Is it same as the one on github for the content that you want?
Oh, I think I get it -- git simply doesn't support fetching only that one directory I want; it will always fetch every other directory under the root too, even though I don't need those. That's what I was not understanding. I though I could just clone that github sub-directory URL directly. But OK, I get it now. Thanks for the help.
0

You can clone anything you want with GIT.
Branches tags, commit and so on.

You simply have to pass the right parameter to the clone command.

Gow to clone specific branch? (-b flag)

# use the -b flag to clone a specifc branch git clone -b <branch> <remote_repo> 

--single-branch flag

--[no-]single-branch

Clone only the history leading to the tip of a single branch, either specified by the --branch option or the primary branch remote’s HEAD points at.

Further fetches into the resulting repository will only update the remote-tracking branch for the branch this option was used for the initial cloning.

If the HEAD at the remote did not point at any branch when --single-branch clone was made, no remote-tracking branch is created.


git checkout tags/<tag name>

Clone the repo and then checkout the desired tag:

# Checkout specific tag and create branch with the desired name git checkout tags/<tag_name> -b <tag_name> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.