Re: question git & branches
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Aug 29, 2005, 15:03 UTC
- Message-ID
- <Pine.LNX.4.58.0508290754410.3243@g5.osdl.org>
- In-Reply-To
- <4312C24E.4000803@candelatech.com>
On Mon, 29 Aug 2005, Ben Greear wrote:
Show 6 quoted lines
> > I think I'm missing something fundamental though... I wanted to > change to the ben_dev_rfcnt branch to build a kernel without my > additional patch. git branch ben_dev_rfcnt seems to change > it fine, but all of the changes for repository 'foo' are also > still here.
"git branch" just creates the branch, it doesn't actually do anything else. Use "git checkout <branchname>" to switch to it.
You can do both with "bit checkout -b <branchname>" which both creates the branch and switches to it.
(Both "git branch" and "git checkout -b <branchname>" that reate a new branch take an optional argument which says what point you want the branch to start at. It defaults to "current state", but you can create a branch at any point in the history by just explicitly stating the commit name that you want to start off with as the head of the branch)
Use "gitk --all" to visualize where the different branches are in the history, and a plain "git branch" with no arguments to list the branches and mark your currently active branch.
Linus