Re: unable to checkout branches and proper procedure for creating a new branch based off of another one
- From
- Thomas Anderson <zelnaga@gmail.com>
- Date
- Jun 17, 2010, 03:44 UTC
- Message-ID
- <AANLkTilasCQ1_F0z8NTaJzFNvgnFGImlGN5DcOh0O7VV@mail.gmail.com>
- In-Reply-To
- <AANLkTillFOvwAK_rHhUjhbjRupD1DnQpcMFB3QbExctt@mail.gmail.com>
Also, directories that are present in the "branch" branch aren't present in the current working directory, despite my having switched over. "git checkout origin/branch" adds the missing directories but "git checkout -b origin/branch" does not. Which leaves me wondering what the latter is doing.
On Wed, Jun 16, 2010 at 10:32 PM, Thomas Anderson <zelnaga@gmail.com> wrote:
Show 40 quoted lines
> I guess what I was trying to do was checkout a remote branch. Of > course, it's unclear to me what the difference between "git checkout > origin/branch" and "git checkout -b origin/branch" is. The latter > creates a local branch and the former doesn't? Does that mean that, > with the former, changes I commit and subsequently push will get > written to the remote default branch and not the remote "branch" > branch? > > And how do I check that files in the current working directory are > from the desired branch? "git log" shows commits made to the default > branch - not to the "default" branch, which doesn't give me much > confidence... > > On Wed, Jun 16, 2010 at 9:41 PM, Thomas Anderson <zelnaga@gmail.com> wrote: >> Say there's a Git repository with two branches: default (which is the >> default branch) and branch. I want to checkout branch and start >> working on that but am unsure of how to do it. Here are the commands >> that I did: >> >> git clone git@github.com:username/repo.git >> cd repo >> git checkout branch >> >> But that gets me the following error: >> >> fatal: Not a git repository (or any of the parent directories): .git >> >> I do "git branch" and here's what I see: >> >> * default >> >> Where's "branch"? >> >> And let's say I wanted to create my own branch based on "branch". >> Let's say "branch-zelnaga". How would I do that? Do I just checkout >> that branch, create a new branch while the current working directory >> contains files from the desired branch and then push / commit as >> appropriate? >> >