当前位置: 代码迷 >> 综合 >> Your local changes to the following files would be overwritten ...Please commit your change
  详细解决方案

Your local changes to the following files would be overwritten ...Please commit your change

热度:3   发布时间:2023-11-24 03:06:25.0

git 报错信息:

git pull
error: Your local changes to the following files would be overwritten by merge:
src/main/java/com/demo/controller/PanUserController.java
Please commit your changes or stash them before you merge.
Aborting
Updating 78c724c…b3c9a95

解决办法

1、服务器代码合并本地代码

$ git stash     //暂存当前正在进行的工作。
$ git pull   origin master //拉取服务器的代码
$ git stash pop //合并暂存的代码

2、服务器代码覆盖本地代码

$git reset --hard  //回滚到上一个版本
$git pull origin master 
  相关解决方案