git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Previous: Suchi UpadhyayNext: supadhyay
Message 4 of 9 in “how to clone/checkout branch/tag vesion from GIT repository”
  1. supadhyayMay 10, 2012
  2. Jeff KingMay 10, 2012
  3. Suchi UpadhyayMay 10, 2012
  4. Jeff KingMay 10, 2012
  5. supadhyayMay 11, 2012
  6. Jeff KingMay 11, 2012
  7. supadhyayMay 12, 2012
  8. supadhyayMay 14, 2012
  9. Jeff KingMay 14, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.