[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Git repository and branches ?

From: Miles Bader
Subject: Re: Git repository and branches ?
Date: Thu, 21 Feb 2008 10:48:16 +0900

Xavier Maillard <address@hidden> writes:
> How can I get a specific branch of the current CVS using the git
> repository ? Cloning the git repository has only fetched the
> master branch.

Cloning with git fetches _all_ branches that exist in the cloned git
repo.  They are under the "origin/" namespace.

You can see them with:

   git branch -a

To switch your working directory to one of those branches, you can use
the git-checkout command.  It's possibly to simply checkout one of the
origin branches (e.g., "git checkout origin/lexbind"), but generally you
don't want to do unless you're not going to do any modifications (the
reason is that "origin/" branches are supposed to represent the pristine
contents of the repo you cloned from, to make future interaction
easier).  So the more usual method is to create a local branch which
tracks the given origin branch, e.g.:

   git checkout -b lexbind origin/lexbind

[After that, you can switch to your local lexbind branch by just
using "git checkout lexbind"; to switch back to the trunk, use
"git checkout master".]


Quack, n. A murderer without a license.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]