Re: Re: [PATCH/RFC] builtin-checkout: suggest creating local branch when appropriate to do so
From: Eugene Sajine <hidden>
Date: 2016-06-15 22:47:29
It seams that my first email was eaten by the server for some reason... Sorry, if it will be a dupe. On Tue, Oct 6, 2009 at 12:18 PM, [off-list ref] wrote: Hi, If i may have a word:
On Oct 6, 2009 5:41am, Mikael Magnusson [off-list ref] wrote:quoted
I can imagine this happening: % git clone git://git.git git % git checkout next do you want to checkout origin/next? y # a few days later % git fetch % git checkout next [freenode] /join #git [#git] i did git checkout next but my files are still the same?
I'm a new user of git and I don't think i will ever have a commit in
git.git, because I'm not a programmer (I'm QA). I was reading this topic as
carefully as i could and I think that this makes a lot of sense to address
this issue. As i understand when somebody fetches from remote repo in order
to be able to start working on the code from this remote repo you should
create tracking branch for one of the branches from remote and only then you
should do your changes or perform merges.
in case if you didn't do that and you try to checkout you will end up having
detached HEAD which is quite scary;) for non-experienced user and as i see
might lead to some unnecessary questions in this list or on IRC channel...
As for the solution i would choose the "simplest thing that will work" - so
i think that we just have to notify user about his suicide attempt to
checkout nonlocal branch and offer him a correct syntax to go with.
Something like below should work:
% git clone git://git.git git
% git checkout next
You're attempting to checkout to non-local branch. This will lead to your
HEAD being detached (our team is on its way!).
Do you want to check out local branch 'next' tracking 'origin/next' instead?
y/n
if yes, then:
Created branch "next" tracking "origin/next"
You can update it with 'git pull'.
If no - abort or continue with checkout to nonlocal branch? ('m not sure if
detaching HEAD can provide some benefits if done on purpose)
I hope I'm not missing anything...
Thanks,
Eugene