git pull 生产部署出错

  • 2020 年 3 月 17 日
  • 筆記

Your local changes to the following files would be overwritten by merge

error: Your local changes to the following files would be overwritten by merge:

……

Please, commit your changes or stash them before you can merge.

这是由于在生产服务器上对某些文件产生了改动,从远程仓库拉回新的版本会有冲突。通常有以下两种办法:

1.保存生产服务器上的更改

git stash

git pull origin master

git stash pop

2.完全从远程仓库重新覆盖

git reset –hard

git pull origin master

origin master 是远程仓库的主分支

标签: 无