git checkout experiment is allowed sometimes and sometimes not if I have local changes

Posted by dorelal on Stack Overflow See other posts from Stack Overflow or by dorelal
Published on 2010-03-26T14:32:58Z Indexed on 2010/03/26 14:43 UTC
Read the original article Hit count: 306

Filed under:

I have a branch called experiment.

git checkout master
echo 'some changes' > a.txt
# now master branch has local changes which are not committed
git checkout experiment

Sometimes I have noticed that I am not allowed to switch to another branch if I have local changes. And sometimes I am allowed to switch to another branch if I have local changes.

What am I missing?

© Stack Overflow or respective owner

Related posts about git