error: Your local changes to the following files would be overwritten by checkout:
hello.py
Please, commit your changes or stash them before you can switch branches.
Aborting
先使用下边的命令,恢复到之前的状态,
git reset --hard
然后再执行
git checkout [选项]
解释:
git reset --hard 可以在add前后,恢复工作区之前的所有文件的状态。
如果确定只修改了一个文件 ,可以使用
git checkout -- filename
但是还是建议用git reset