Re: how to clone/checkout branch/tag vesion from GIT repository
- From
Jeff King <peff@peff.net>
- Date
- May 10, 2012, 14:39 UTC
- Message-ID
- <20120510143911.GB14711@sigill.intra.peff.net>
- In-Reply-To
- <49A2AA38871E7B41841AA7D659D626A62E2098A2@njexch01.imany.com>
On Thu, May 10, 2012 at 10:19:12AM -0400, Suchi Upadhyay wrote:
Show 6 quoted lines
> 2- for branch: > $ git checkout br6-1-0 > > Suchi - As per my understanding with GIT this command will create a > new branch in my repository..for ex. If I run "git checkout suchi" > then it will create suchi as a new branch.
Not exactly. It will do one of:
1. If a local branch named br6-1-0 exists, it will be checked out.
2. If a tag named br6-1-0 exists, then you will be put in a "detached
HEAD" state, starting at the tag. See the "detached HEAD" section
of "git help checkout" for details. 3. If a remote branch named br6-1-0 exists, a local branch of the same
name will be created, starting at the same spot.4. Otherwise, it is an error.
Show 6 quoted lines
> Please note that - branch br6-1-0 created in CVS and then our source > code migrated to Git. But in migration output I can see the br6-1-0 > picked up for copying ... > [...] > Suchi - I want a branch list from remote. I have run your suggested > command but it shows only tag list and no branch.
>From the message you are seeing from "git clone -b", and from the output
of "ls-remote", it sounds like br6-1-0 really is a tag in git, not a branch. Since you have said it is coming from CVS, I suspect this is an artifact of the CVS->git conversion. And if that is not the desired outcome, you should look into your conversion process (there are several tools available; if you used git-cvsimport, it is generally considered to to be the least accurate, and you might try cvs2git).
-Peff