Re: master^ is not a local branch -- huh?!?
- From
- Octavio Alvarez <alvarezp@alvarezp.ods.org>
- Date
- Jan 29, 2010, 20:32 UTC
- Message-ID
- <op.u7a909hf4oyyg1@alvarezp-ws>
- In-Reply-To
- <ron1-2E17EF.12204629012010@news.gmane.org>
On Fri, 29 Jan 2010 12:20:46 -0800, Ron1 <ron1@flownet.com> wrote:
Show 17 quoted lines
> [ron@mickey]$ git checkout master > Already on 'master' > [ron@mickey]$ git checkout master^ > Note: moving to 'master^' which isn't a local branch > If you want to create a new branch from this checkout, you may do so > (now or later) by using -b with the checkout command again. Example: > git checkout -b <new_branch_name> > HEAD is now at 7be05e0... test > [ron@mickey]$ git branch > * (no branch) > master > [ron@mickey]$ > > Huh?!? > > This is a test repository which has never been pulled from nor pushed to > anywhere. So how is it possible that I have a non-local branch?
"Is a non-local branch" is not the same as "is not a local branch".
Think "branches" as tags that advance when you commit over them.
If you do gitk --all, only those commits with a green tag are "branches".
It means that if you switch to master^ and commit, your commit will be applied but not tracked (since there is not any branch to advance).
You would need to do git checkout -b 'new_branch', and then commit. Now, new_branch will advance with your new commit.