git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how to clone/checkout branch/tag vesion from GIT repository
@ 2012-05-10 13:39 supadhyay
  2012-05-10 13:56 ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: supadhyay @ 2012-05-10 13:39 UTC (permalink / raw)
  To: git

Hi All,

I try to use below command to do clone from particular branch/version
number. I used below command...

$ git clone -b br6-1-0 ssh://gitolite@myservername/testrep
Cloning into 'testrep'...
remote: Counting objects: 19536, done.
remote: Compressing objects: 100% (5850/5850), done.
remote: Total 19536 (delta 13869), reused 18869 (delta 13202)
Receiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.
Resolving deltas: 100% (13869/13869), done.
warning: Remote branch br6-0 not found in upstream origin, using HEAD
instead


End user query is - they want the clone from particular branch which is
separate from Head so I run above commmand. Can any one please help me how
to resolve this?


Is there any way to findout how many branches are available in my GIT
repository. 



Thanks in advance...

--
View this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-10 13:39 how to clone/checkout branch/tag vesion from GIT repository supadhyay
@ 2012-05-10 13:56 ` Jeff King
  2012-05-10 14:19   ` Suchi Upadhyay
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2012-05-10 13:56 UTC (permalink / raw)
  To: supadhyay; +Cc: git

On Thu, May 10, 2012 at 06:39:47AM -0700, supadhyay wrote:

> I try to use below command to do clone from particular branch/version
> number. I used below command...
> 
> $ git clone -b br6-1-0 ssh://gitolite@myservername/testrep
> Cloning into 'testrep'...
> remote: Counting objects: 19536, done.
> remote: Compressing objects: 100% (5850/5850), done.
> remote: Total 19536 (delta 13869), reused 18869 (delta 13202)
> Receiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.
> Resolving deltas: 100% (13869/13869), done.
> warning: Remote branch br6-0 not found in upstream origin, using HEAD
> instead

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?

Assuming that is the case, the problem is that git versions before
v1.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:

  $ git clone ssh://.../testrep
  $ cd testrep
  $ git checkout br6-1-0

Note that if you are planning on doing work based on the tag, you
probably want to create a new branch, like:

  $ git checkout -b my-work br6-1-0

> Is there any way to findout how many branches are available in my GIT
> repository.

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://...".

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-10 13:56 ` Jeff King
@ 2012-05-10 14:19   ` Suchi Upadhyay
  2012-05-10 14:39     ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Suchi Upadhyay @ 2012-05-10 14:19 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Jeff,

Thanks for your prompt reply.

Please see my reply below:

1- 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?

Suchi - yes my mistake in cut & paste. Branch name is br6-1-0

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.

2.1 Note that if you are planning on doing work based on the tag, you probably want to create a new branch, like:
  $ git checkout -b my-work br6-1-0

Suchi - 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).

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 ...


3- 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://...".

Suchi - I want a branch list from remote. I have run your suggested command  but it shows only tag list and no branch.


Thanks,
Suchi

-----Original Message-----
From: Jeff King [mailto:peff@peff.net] 
Sent: Thursday, May 10, 2012 7:26 PM
To: Suchi Upadhyay
Cc: git@vger.kernel.org
Subject: Re: how to clone/checkout branch/tag vesion from GIT repository

On Thu, May 10, 2012 at 06:39:47AM -0700, supadhyay wrote:

> I try to use below command to do clone from particular branch/version 
> number. I used below command...
> 
> $ git clone -b br6-1-0 ssh://gitolite@myservername/testrep
> Cloning into 'testrep'...
> remote: Counting objects: 19536, done.
> remote: Compressing objects: 100% (5850/5850), done.
> remote: Total 19536 (delta 13869), reused 18869 (delta 13202) 
> Receiving objects: 100% (19536/19536), 61.44 MiB | 17 KiB/s, done.
> Resolving deltas: 100% (13869/13869), done.
> warning: Remote branch br6-0 not found in upstream origin, using HEAD 
> instead

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?

Assuming that is the case, the problem is that git versions before
v1.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:

  $ git clone ssh://.../testrep
  $ cd testrep
  $ git checkout br6-1-0

Note that if you are planning on doing work based on the tag, you probably want to create a new branch, like:

  $ git checkout -b my-work br6-1-0

> Is there any way to findout how many branches are available in my GIT 
> repository.

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://...".

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-10 14:19   ` Suchi Upadhyay
@ 2012-05-10 14:39     ` Jeff King
  2012-05-11 12:45       ` supadhyay
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2012-05-10 14:39 UTC (permalink / raw)
  To: Suchi Upadhyay; +Cc: git

On Thu, May 10, 2012 at 10:19:12AM -0400, Suchi Upadhyay wrote:

> 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.

> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-10 14:39     ` Jeff King
@ 2012-05-11 12:45       ` supadhyay
  2012-05-11 17:22         ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: supadhyay @ 2012-05-11 12:45 UTC (permalink / raw)
  To: git

Hi Jeff,

Thanks for your reply.

branch - br6-1-0 is already exists on remote. I have my few data which are
associated on this branch and I want to get that specific data from br6-1-0.

I did cvs2git and its working fine without any issue. 

Also I can see the  list of branches when I run "git branch -r"  on my
GITserver through "git" user. But after did this migration I do clone from
git to gitolite on the same server (to manage with user functionality). Now,
after cloning to gitolite if I run "git branch -r" it shows only master.

I follow belwo step
1- cvs 2 git  >> I can see list of branches here 
2- git 2 gitolite  >> I can not see any branch except master.

Thanks,
Suchi

--
View this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7550370.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-11 12:45       ` supadhyay
@ 2012-05-11 17:22         ` Jeff King
  2012-05-12 10:26           ` supadhyay
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2012-05-11 17:22 UTC (permalink / raw)
  To: supadhyay; +Cc: git

On Fri, May 11, 2012 at 05:45:19AM -0700, supadhyay wrote:

> branch - br6-1-0 is already exists on remote. I have my few data which are
> associated on this branch and I want to get that specific data from br6-1-0.
> 
> I did cvs2git and its working fine without any issue. 
> 
> Also I can see the  list of branches when I run "git branch -r"  on my
> GITserver through "git" user. But after did this migration I do clone from
> git to gitolite on the same server (to manage with user functionality). Now,
> after cloning to gitolite if I run "git branch -r" it shows only master.
> 
> I follow belwo step
> 1- cvs 2 git  >> I can see list of branches here 
> 2- git 2 gitolite  >> I can not see any branch except master.

How did you do the clone? A regular "clone" will clone only local
branches of the remote repository (so if B fetches from A, and C fetches
from B, C will not bother with A's branches).

If you are trying to clone the repository to act as a server repository
in gitolite, I think you would want to use "git clone --mirror". This will
omit the working tree (which you should not need for the server end),
and will fetch all branches (exactly mirroring the state of the original
repository).

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-11 17:22         ` Jeff King
@ 2012-05-12 10:26           ` supadhyay
  2012-05-14  6:18             ` supadhyay
  2012-05-14 17:33             ` Jeff King
  0 siblings, 2 replies; 9+ messages in thread
From: supadhyay @ 2012-05-12 10:26 UTC (permalink / raw)
  To: git

Hi Jeff,

I follow below steps to do clone from git to gitolite (I did the cvs2git
migration of individual repository successfully).

1- login to gitolite user and  add repository entry in to gitolite.conf file
and do add,commit and push.  In push operation output it shows the path of
the repository.

2- from gitolite_home I run below command
git clone ssh://git@mygitserver.com/ora/data/test.git
(tis is do the clone of my repository so I can see the actual data inside
the repository)

3- then cd to test and push all the changes ;
git push --all gitolite@mygitserver.com:test

4- push all tags also;
git push --tags gitolite@mygitserver.com:test


5- lastly do the clone of test repository to my workstation using tortoise
git tool;
ssh://gitolite@mygitserver/test



Please guide me if anything missing or needs to add.

Thanks.


--
View this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7553161.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-12 10:26           ` supadhyay
@ 2012-05-14  6:18             ` supadhyay
  2012-05-14 17:33             ` Jeff King
  1 sibling, 0 replies; 9+ messages in thread
From: supadhyay @ 2012-05-14  6:18 UTC (permalink / raw)
  To: git

Hi Jeff,

Did you find anything missing/wrong approach in the above steps?

Thanks...

--
View this message in context: http://git.661346.n2.nabble.com/how-to-clone-checkout-branch-tag-vesion-from-GIT-repository-tp7546744p7555785.html
Sent from the git mailing list archive at Nabble.com.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: how to clone/checkout branch/tag vesion from GIT repository
  2012-05-12 10:26           ` supadhyay
  2012-05-14  6:18             ` supadhyay
@ 2012-05-14 17:33             ` Jeff King
  1 sibling, 0 replies; 9+ messages in thread
From: Jeff King @ 2012-05-14 17:33 UTC (permalink / raw)
  To: supadhyay; +Cc: Sitaram Chamarty, git

On Sat, May 12, 2012 at 03:26:32AM -0700, supadhyay wrote:

> 2- from gitolite_home I run below command
> git clone ssh://git@mygitserver.com/ora/data/test.git
> (tis is do the clone of my repository so I can see the actual data inside
> the repository)

As I mentioned before, this should probably be a --mirror clone to get
all of the remote branches, and to create a bare repository. I don't use
gitolite, so perhaps there is some need I don't know about for it to
have a working tree. But in general, I would think having a non-bare
repository would be a problem here, as it would prevent pushes to the
checked-out branch (but again, maybe there is some gitolite-specific
thing I am missing).

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-05-14 17:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10 13:39 how to clone/checkout branch/tag vesion from GIT repository supadhyay
2012-05-10 13:56 ` Jeff King
2012-05-10 14:19   ` Suchi Upadhyay
2012-05-10 14:39     ` Jeff King
2012-05-11 12:45       ` supadhyay
2012-05-11 17:22         ` Jeff King
2012-05-12 10:26           ` supadhyay
2012-05-14  6:18             ` supadhyay
2012-05-14 17:33             ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).