Web lists-archives.com

bug during checkout of remote branch and uncommited changes ?




Hi,

Lately I've been caught several time with a problem which,
to me, is a bug. It can easily be reproduced, so I think
It's very possible it has already been reported.

The problem arise when trying to checkout a branch while having
some uncommited changes. The scenario is the following:
	$ git status
	M  afile.c
	$ git remote add <aremote> <anurl> 
	$ git fetch <aremote> <abranch>
	remote: Counting objects: 7, done.
	remote: Compressing objects: 100% (6/6), done.
	remote: Total 7 (delta 5), reused 3 (delta 1)
	Unpacking objects: 100% (7/7), done.
	From <anurl>
	 * branch                <abranch> -> FETCH_HEAD
	 * [new branch]          <abranch> -> <aremote>/<abranch>
	$ git co <abranch>
	error: Your local changes to the following files would be overwritten by checkout:
		afile.c
	Please commit your changes or stash them before you switch branches.
	Aborting
	$ git reset --hard
	patching file afile.c
	$ git co <abranch>
	fatal: Not tracking: ambiguous information for ref refs/remotes/<aremote>/<abranch>

What can be ambiguous here?
Strangely, trying a second time, succeed:
	$ git co <abranch>
	Previous HEAD position was ...
	Switched to branch '<abranch>'

-- Luc Van Oostenryck