On Thu, Feb 01, 2007 at 01:08:41AM -0800, Junio C Hamano wrote: > [git.git]$ git checkout master > You are not on any branch and switching to branch 'master' > may lose your changes. At this point, you can do one of two things: > (1) Decide it is Ok and say 'git checkout -f master'; > (2) Start a new branch from the current commit, by saying > 'git checkout -b <branch-name>'. > Leaving your HEAD detached; not switching to branch 'master'. How hard would it be to simply simply set a flag once git has entered a detached HEAD state, and clear the flag if any git operation has modified the repository at all. If the flag is still set, then obviously the repository hasn't changed and so there are no changes that could be lost. i.e., if I've do: <tytso@candygram> {/usr/projects/e2fsprogs/hg-to-git/test} [master] 181% git checkout 2ab15cafae661765ecd7f256b1993b94d5534faf warning: you are not on ANY branch anymore. If you meant to create a new branch from this checkout, you may still do so (now or later) by using -b with the checkout command again. Example: git checkout -b <new_branch_name> <tytso@candygram> {/usr/projects/e2fsprogs/hg-to-git/test} 182% git checkout master You are not on any branch and switching to branch 'master' may lose your changes. At this point, you can do one of two things: (1) Decide it is Ok and say 'git checkout -f master'; (2) Start a new branch from the current commit, by saying 'git checkout -b <branch-name>'. Leaving your HEAD detached; not switching to branch 'master'. It's really obvious there are no changes, so it makes git seem a little stupid to always be saying "may lose your changes". Can we simply let git know that there weren't any changes? Otherwise we're just training users to just always use the -f option. - Ted - 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