2

I've been cloning a few repos from github that, even though I know they have branches/tags, do not have them once I clone them onto my local drive. strange. I try to list the tags (git tag) but nothing comes up...
I would look into .git/refs/tags/ and that too is empty.

the repos in question are:
http://github.com/jchris/hovercraft.git
http://github.com/apache/couchdb.git

any ideas? I really need specific tags/branches, and not the HEAD of the master

deepblue
  • 7,836
  • 12
  • 45
  • 59

2 Answers2

3

As mentionned in GitHub remotes:

Running git clone URL will automatically create a new subfolder, fetch the contents of the repo into this subfolder, then create and checkout the default branch (usually “master”).
If there are other branches on the remote you will need to create a local branch to work in, for example git checkout -b fix_stuff origin/fix_stuff

Meaning all the branches should be there, but in the 'remotes' namespace of your repo.
But you usually have only one remote tracking branch created for you after a clone (the default one, usually 'master').

Try a git branch -a or a gitk --all to check if you do see them.


As for tags (normally present in refs/tags namespace), let's hope it is not a repeat of this issue (March 2010).

Sorry everyone, we had a little snafu with the tag parser... tags should be showing up again as caches clear.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
1

Once you've cloned the repository, only master is set up for you. You can start using a remote branch locally with the command:

git checkout -t origin/1.2.x

That creates a local branch named 1.2.x that "tracks" (e.g., pushes and pulls from) the remote branch, and switches you to it.

As previously mentioned, you can see all branches (local & remote) with:

git branch -a

Tags should be a part of the cloned repo automatically. You can see all tags with one of these:

git tag     # Show bare list of tags.
git tag -n  # Show tags with first line of annotation specified at tag creation.
git tag -n4 # Show tags with 4 lines of annotation, if available.

Hope that helps!

brookr
  • 1,424
  • 11
  • 14