{"thread":{"id":"30492","subject":"how to clone/checkout branch/tag vesion from GIT repository","startedAt":"2012-05-10T13:39:47Z","lastAt":"2012-05-14T17:33:58Z","messageCount":9,"participants":["supadhyay","Jeff King","Suchi Upadhyay"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"191285","messageId":"1336657187852-7546744.post@n2.nabble.com","threadId":"30492","inReplyTo":null,"subject":"how to clone/checkout branch/tag vesion from GIT repository","fromName":"supadhyay","fromEmail":"supadhyay@imany.com","sentAt":"2012-05-10T13:39:47Z","receivedAt":"2012-05-10T13:39:47Z","isPatch":false,"sender":{"key":"supadhyay@imany.com","avatar":null},"body":"Hi All,\n\nI try to use below command to do clone from particular branch/version\nnumber. I used below command...\n\n$ git clone -b br6-1-0 ssh://gitolite@myservername/testrep\nCloning into 'testrep'...\nremote: Counting objects: 19536, done.\nremote: Compressing objects: 100% (5850/5850), done.\nremote: Total 19536 (delta 13869), reused 18869 (delta 13202)\nReceiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.\nResolving deltas: 100% (13869/13869), done.\nwarning: Remote branch br6-0 not found in upstream origin, using HEAD\ninstead\n\n\nEnd user query is - they want the clone from particular branch which is\nseparate from Head so I run above commmand. Can any one please help me how\nto resolve this?\n\n\nIs there any way to findout how many branches are available in my GIT\nrepository. \n\n\n\nThanks in advance...\n\n--\nView this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"191287","messageId":"20120510135605.GA1495@sigill.intra.peff.net","threadId":"30492","inReplyTo":"1336657187852-7546744.post@n2.nabble.com","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-10T13:56:05Z","receivedAt":"2012-05-10T13:56:05Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 10, 2012 at 06:39:47AM -0700, supadhyay wrote:\n\n> I try to use below command to do clone from particular branch/version\n> number. I used below command...\n> \n> $ git clone -b br6-1-0 ssh://gitolite@myservername/testrep\n> Cloning into 'testrep'...\n> remote: Counting objects: 19536, done.\n> remote: Compressing objects: 100% (5850/5850), done.\n> remote: Total 19536 (delta 13869), reused 18869 (delta 13202)\n> Receiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.\n> Resolving deltas: 100% (13869/13869), done.\n> warning: Remote branch br6-0 not found in upstream origin, using HEAD\n> instead\n\nSide note: if I repeat your experiment, I get \"br6-1-0\" in the error\nmessage (i.e., what was on the command line). Is this just a cut and\npaste mistake in reporting the error, or is that actually what you see?\n\nAssuming that is the case, the problem is that git versions before\nv1.7.10 did not expect a tag name with the \"-b\" switch. Either upgrade\nto git v1.7.10, or clone and manually switch to the tag, like this:\n\n  $ git clone ssh://.../testrep\n  $ cd testrep\n  $ git checkout br6-1-0\n\nNote that if you are planning on doing work based on the tag, you\nprobably want to create a new branch, like:\n\n  $ git checkout -b my-work br6-1-0\n\n> Is there any way to findout how many branches are available in my GIT\n> repository.\n\nIn your local clone, or on the remote? In the local clone, you can use\n\"git branch\" to see local branches, or \"git branch -a\" to see branches\ncopied from the remote. To see what is available on the remote, try \"git\nls-remote ssh://...\".\n\n-Peff\n"},{"id":"191294","messageId":"49A2AA38871E7B41841AA7D659D626A62E2098A2@njexch01.imany.com","threadId":"30492","inReplyTo":"20120510135605.GA1495@sigill.intra.peff.net","subject":"RE: how to clone/checkout branch/tag vesion from GIT repository","fromName":"Suchi Upadhyay","fromEmail":"supadhyay@revitasinc.com","sentAt":"2012-05-10T14:19:12Z","receivedAt":"2012-05-10T14:19:12Z","isPatch":false,"sender":{"key":"supadhyay@revitasinc.com","avatar":null},"body":"Hi Jeff,\n\nThanks for your prompt reply.\n\nPlease see my reply below:\n\n1- Side note: if I repeat your experiment, I get \"br6-1-0\" in the error message (i.e., what was on the command line). Is this just a cut and paste mistake in reporting the error, or is that actually what you see?\n\nSuchi - yes my mistake in cut & paste. Branch name is br6-1-0\n\n2- for branch:\n$ git checkout br6-1-0\n\nSuchi - 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.\n\n2.1 Note that if you are planning on doing work based on the tag, you probably want to create a new branch, like:\n  $ git checkout -b my-work br6-1-0\n\nSuchi - Yes, I have this branch br6-1-0 and data is associated there, this branch is different from head. For end user perspective I just want to make sure that my data is there or not so I performed clone but not working (Again not sure which command I have to use).\n\nPlease 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 ...\n\n\n3- In your local clone, or on the remote? In the local clone, you can use \"git branch\" to see local branches, or \"git branch -a\" to see branches copied from the remote. To see what is available on the remote, try \"git ls-remote ssh://...\".\n\nSuchi - I want a branch list from remote. I have run your suggested command  but it shows only tag list and no branch.\n\n\nThanks,\nSuchi\n\n-----Original Message-----\nFrom: Jeff King [mailto:peff@peff.net] \nSent: Thursday, May 10, 2012 7:26 PM\nTo: Suchi Upadhyay\nCc: git@vger.kernel.org\nSubject: Re: how to clone/checkout branch/tag vesion from GIT repository\n\nOn Thu, May 10, 2012 at 06:39:47AM -0700, supadhyay wrote:\n\n> I try to use below command to do clone from particular branch/version \n> number. I used below command...\n> \n> $ git clone -b br6-1-0 ssh://gitolite@myservername/testrep\n> Cloning into 'testrep'...\n> remote: Counting objects: 19536, done.\n> remote: Compressing objects: 100% (5850/5850), done.\n> remote: Total 19536 (delta 13869), reused 18869 (delta 13202) \n> Receiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.\n> Resolving deltas: 100% (13869/13869), done.\n> warning: Remote branch br6-0 not found in upstream origin, using HEAD \n> instead\n\nSide note: if I repeat your experiment, I get \"br6-1-0\" in the error message (i.e., what was on the command line). Is this just a cut and paste mistake in reporting the error, or is that actually what you see?\n\nAssuming that is the case, the problem is that git versions before\nv1.7.10 did not expect a tag name with the \"-b\" switch. Either upgrade to git v1.7.10, or clone and manually switch to the tag, like this:\n\n  $ git clone ssh://.../testrep\n  $ cd testrep\n  $ git checkout br6-1-0\n\nNote that if you are planning on doing work based on the tag, you probably want to create a new branch, like:\n\n  $ git checkout -b my-work br6-1-0\n\n> Is there any way to findout how many branches are available in my GIT \n> repository.\n\nIn your local clone, or on the remote? In the local clone, you can use \"git branch\" to see local branches, or \"git branch -a\" to see branches copied from the remote. To see what is available on the remote, try \"git ls-remote ssh://...\".\n\n-Peff\n"},{"id":"191296","messageId":"20120510143911.GB14711@sigill.intra.peff.net","threadId":"30492","inReplyTo":"49A2AA38871E7B41841AA7D659D626A62E2098A2@njexch01.imany.com","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-10T14:39:11Z","receivedAt":"2012-05-10T14:39:11Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, May 10, 2012 at 10:19:12AM -0400, Suchi Upadhyay wrote:\n\n> 2- for branch:\n> $ git checkout br6-1-0\n> \n> Suchi - As per my understanding with GIT this command will create a\n> new branch in my repository..for ex. If I run \"git checkout suchi\"\n> then it will create suchi as a new branch.\n\nNot exactly. It will do one of:\n\n  1. If a local branch named br6-1-0 exists, it will be checked out.\n\n  2. If a tag named br6-1-0 exists, then you will be put in a \"detached\n     HEAD\" state, starting at the tag. See the \"detached HEAD\" section\n     of \"git help checkout\" for details.\n\n  3. If a remote branch named br6-1-0 exists, a local branch of the same\n     name will be created, starting at the same spot.\n\n  4. Otherwise, it is an error.\n\n> Please note that  - branch br6-1-0 created in CVS and then our source\n> code migrated to Git. But in migration output I can see the br6-1-0\n> picked up for copying ...\n> [...]\n> Suchi - I want a branch list from remote. I have run your suggested\n> command  but it shows only tag list and no branch.\n\n>From the message you are seeing from \"git clone -b\", and from the output\nof \"ls-remote\", it sounds like br6-1-0 really is a tag in git, not a\nbranch. Since you have said it is coming from CVS, I suspect this is an\nartifact of the CVS->git conversion. And if that is not the desired\noutcome, you should look into your conversion process (there are several\ntools available; if you used git-cvsimport, it is generally considered\nto to be the least accurate, and you might try cvs2git).\n\n-Peff\n"},{"id":"191392","messageId":"1336740319206-7550370.post@n2.nabble.com","threadId":"30492","inReplyTo":"20120510143911.GB14711@sigill.intra.peff.net","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"supadhyay","fromEmail":"supadhyay@imany.com","sentAt":"2012-05-11T12:45:19Z","receivedAt":"2012-05-11T12:45:19Z","isPatch":false,"sender":{"key":"supadhyay@imany.com","avatar":null},"body":"Hi Jeff,\n\nThanks for your reply.\n\nbranch - br6-1-0 is already exists on remote. I have my few data which are\nassociated on this branch and I want to get that specific data from br6-1-0.\n\nI did cvs2git and its working fine without any issue. \n\nAlso I can see the  list of branches when I run \"git branch -r\"  on my\nGITserver through \"git\" user. But after did this migration I do clone from\ngit to gitolite on the same server (to manage with user functionality). Now,\nafter cloning to gitolite if I run \"git branch -r\" it shows only master.\n\nI follow belwo step\n1- cvs 2 git  >> I can see list of branches here \n2- git 2 gitolite  >> I can not see any branch except master.\n\nThanks,\nSuchi\n\n--\nView this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7550370.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"191403","messageId":"20120511172214.GC26916@sigill.intra.peff.net","threadId":"30492","inReplyTo":"1336740319206-7550370.post@n2.nabble.com","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-11T17:22:14Z","receivedAt":"2012-05-11T17:22:14Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, May 11, 2012 at 05:45:19AM -0700, supadhyay wrote:\n\n> branch - br6-1-0 is already exists on remote. I have my few data which are\n> associated on this branch and I want to get that specific data from br6-1-0.\n> \n> I did cvs2git and its working fine without any issue. \n> \n> Also I can see the  list of branches when I run \"git branch -r\"  on my\n> GITserver through \"git\" user. But after did this migration I do clone from\n> git to gitolite on the same server (to manage with user functionality). Now,\n> after cloning to gitolite if I run \"git branch -r\" it shows only master.\n> \n> I follow belwo step\n> 1- cvs 2 git  >> I can see list of branches here \n> 2- git 2 gitolite  >> I can not see any branch except master.\n\nHow did you do the clone? A regular \"clone\" will clone only local\nbranches of the remote repository (so if B fetches from A, and C fetches\nfrom B, C will not bother with A's branches).\n\nIf you are trying to clone the repository to act as a server repository\nin gitolite, I think you would want to use \"git clone --mirror\". This will\nomit the working tree (which you should not need for the server end),\nand will fetch all branches (exactly mirroring the state of the original\nrepository).\n\n-Peff\n"},{"id":"191439","messageId":"1336818392259-7553161.post@n2.nabble.com","threadId":"30492","inReplyTo":"20120511172214.GC26916@sigill.intra.peff.net","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"supadhyay","fromEmail":"supadhyay@imany.com","sentAt":"2012-05-12T10:26:32Z","receivedAt":"2012-05-12T10:26:32Z","isPatch":false,"sender":{"key":"supadhyay@imany.com","avatar":null},"body":"Hi Jeff,\n\nI follow below steps to do clone from git to gitolite (I did the cvs2git\nmigration of individual repository successfully).\n\n1- login to gitolite user and  add repository entry in to gitolite.conf file\nand do add,commit and push.  In push operation output it shows the path of\nthe repository.\n\n2- from gitolite_home I run below command\ngit clone ssh://git@mygitserver.com/ora/data/test.git\n(tis is do the clone of my repository so I can see the actual data inside\nthe repository)\n\n3- then cd to test and push all the changes ;\ngit push --all gitolite@mygitserver.com:test\n\n4- push all tags also;\ngit push --tags gitolite@mygitserver.com:test\n\n\n5- lastly do the clone of test repository to my workstation using tortoise\ngit tool;\nssh://gitolite@mygitserver/test\n\n\n\nPlease guide me if anything missing or needs to add.\n\nThanks.\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7553161.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"191482","messageId":"1336976325428-7555785.post@n2.nabble.com","threadId":"30492","inReplyTo":"1336818392259-7553161.post@n2.nabble.com","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"supadhyay","fromEmail":"supadhyay@imany.com","sentAt":"2012-05-14T06:18:45Z","receivedAt":"2012-05-14T06:18:45Z","isPatch":false,"sender":{"key":"supadhyay@imany.com","avatar":null},"body":"Hi Jeff,\n\nDid you find anything missing/wrong approach in the above steps?\n\nThanks...\n\n--\nView this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7555785.html\nSent from the git mailing list archive at Nabble.com.\n"},{"id":"191509","messageId":"20120514173358.GA32368@sigill.intra.peff.net","threadId":"30492","inReplyTo":"1336818392259-7553161.post@n2.nabble.com","subject":"Re: how to clone/checkout branch/tag vesion from GIT repository","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-05-14T17:33:58Z","receivedAt":"2012-05-14T17:33:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, May 12, 2012 at 03:26:32AM -0700, supadhyay wrote:\n\n> 2- from gitolite_home I run below command\n> git clone ssh://git@mygitserver.com/ora/data/test.git\n> (tis is do the clone of my repository so I can see the actual data inside\n> the repository)\n\nAs I mentioned before, this should probably be a --mirror clone to get\nall of the remote branches, and to create a bare repository. I don't use\ngitolite, so perhaps there is some need I don't know about for it to\nhave a working tree. But in general, I would think having a non-bare\nrepository would be a problem here, as it would prevent pushes to the\nchecked-out branch (but again, maybe there is some gitolite-specific\nthing I am missing).\n\n-Peff\n"}]}