[Solved] Git switch branch error: 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

Cause of occurrence

You have modified the branch content, and the other branch has the same file

Solution:

Git checkout – f plus an F to force switching

Note: this method will result in the loss of your current modified branch content. If you switch back again, you will find that your changes have disappeared

Similar Posts: