On Wed, 31 Jan 2007, Nicolas Pitre wrote: > On Wed, 31 Jan 2007, Daniel Barkalow wrote: > > > On Tue, 30 Jan 2007, Nicolas Pitre wrote: > > > > > On Tue, 30 Jan 2007, Daniel Barkalow wrote: > > > > > > > warning: you are now browsing the history without a local branch. You > > > > will not be able to commit changes unless you create a new local branch > > > > with "git checkout -b <new_branch_name>". > > > > > > This isn't true. You can commit on top of a detached head. In fact you > > > can do almost anything. > > > > "Commits you make will not be attached to permanent state unless you > > create a local branch"? I'm not sure how the feature turned out to work, > > but I know that (a) you're fine if you don't make any commits and (b) the > > behavior is more like what happens with anonymous checkouts of other > > people's repositories in non-distributed SCMs, so people will tend to > > underestimate what they can do with this, rather than overestimating it > > and getting into trouble. > > > > I suppose it's reasonable to warn at commit time, if we ended up going > > with allowing commits like normal. > > I disagree. > > It is not the commit which is dangerous when the head is detached. It > is the checkout of another branch. And this case is covered already > such that the checkout is refused unless you actually create a branch > for your detached head or you give -f to checkout to override the > protection. > > Giving a warning at commit time is not the place where the user has to > be aware of the issue since it is indeed not the place where there is > any issue to worry about. At commit time, the user is reasonably likely to be doing something unintended (at least, it's more likely that the user is doing something unintended by committing with a detatched head than that the user is doing something unintended by detatching the head). Certainly the only time there's any danger of losing work is when the head is detatched and a commit has been made since it was set, because otherwise there's either no work to lose, or no commits could be becoming unreachable. I suspect that there will be people from other SCMs who will assume they're back on a local branch if the system lets them commit, because they would be prohibited from committing on top of an anonymous checkout or a historical commit. Of course, they can cherry-pick the misplaced commit, so it's not a big deal, but I think it's where a naive user would be getting into a state they don't understand. -Daniel *This .sig left intentionally blank* - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html