这是正常的行为 git checkout :作为 stated in the documentation 以下内容:
git checkout
保存对工作树中文件的本地修改,以便将它们提交到 branch .
branch