git切换分支报错:error: Your local changes to the following files would be overwritten by checkout:


error: Your local changes to the following files would be overwritten by checkout:
view/index/article/show.tpl
Please commit your changes or stash them before you switch branches.
Aborting

出现原因

你修改了分支内容,另一个分支有相同文件

解决办法

git checkout -f 加个f强制切换
注意:这种方式会导致你当前修改的分支内容丢失,你再次切换回去会发现你的更改没了

Git