Git 未触及的回购错误:请在合并前提交您的更改或将其存储起来

Git error on untouched repo: Please commit your changes or stash them before you merge

今天我向我的一个项目推送了 5 次提交,然后在服务器上我拉取了更新,一切都很好。 几个小时后,再次拉动网络服务器,git 抛出:

error: Your local changes to the following files would be overwritten by merge: storage/.DS_Store storage/app/.DS_Store storage/app/public/.DS_Store storage/app/public/css/admin.css storage/app/public/css/master.css storage/app/public/img/.DS_Store storage/app/public/img/products/77/textures/black.png storage/app/public/img/slider/image1.jpg Please commit your changes or stash them before you merge.

在此期间没有人在生产服务器上编辑这些文件,那么为什么 git 抱怨?有人有想法吗?

听起来您服务器上的存储库可能不同步。

你能不能在你的服务器上设置一个 git 状态,看看它说了什么。 此外,执行 git status -b 以确保您在生产分支上可能是个好主意。