解决 error: Your local changes to the following files would be overwritten by merge:XXXX
idea 上将本地代码推送到 git后 , 报错如下图
- error: Your local changes to the following files would be overwritten by merge:
- src/main/resources/application-prod.properties
- Please, commit your changes or stash them before you can merge.
我和同事在改同一个接口,没有注意到他什么时候提交的,应该是忘记了先 pull 。
解决方法 1:
保留本地最新修改,并拉取仓库中忘记 pull 的代码到本地 :
三个命令:
- git stash
- git pull origin master
- git stash pop
解决方法 2:
放弃本地代码,新修改的都不要了,退回上一版本,再拉取代码到本地。
- git reset --hard
- git pull origin master
PS : 如上图,我选择了方法1。后续操作一切正常。
后记(2018.6.13):又看到 另一种类似的操作
在使用Git的过程中,有些时候我们只想要 git 服务器中的最新版本的项目,对于本地的项目中修改不做任何理会,就需要用到 Git pull 的强制覆盖,具体命令如下:
- git fetch --all
- git reset --hard origin/master
- git pull
Git pull的强制覆盖本地文件在自动化部署项目中很有作用,比如用 SaltStack 部署 web 项目,强制覆盖可以保持与服务器内容一致
解决 error: Your local changes to the following files would be overwritten by merge:XXXX的更多相关文章
- 解决error: Your local changes to the following files would be overwritten by merge
在项目里我们一般都会把自己第一次提交的配置文件忽略本地跟踪 1 [Sun@webserver2 demo]$ git update-index --assume-unchanged <filen ...
- git error: Your local changes to the following files would be overwritten by merge:xxxxxx ,Please commit your changes or stash them before you merge.的phpstorm解决办法
git报错 error: Your local changes to the following files would be overwritten by merge: .idea/encoding ...
- Git版本控制工具使用:Error pulling origin: error: Your local changes to the following files would be overwritten by merge
摘自: CSDN 逆觞 git在pull时,出现这种错误的时候,可能很多人进进行stash,相关stash的请看:Error pulling origin: error: Your local cha ...
- Error pulling origin: error: Your local changes to the following files would be overwritten by merge
Git在pull时,出现这种错误的时候,可能很多人进进行stash,相关stash的请看:Error pulling origin: error: Your local changes to the ...
- Git出现error: Your local changes to the following files would be overwritten by merge: ... Please, commit your changes or stash them before you can merge.的问题解决(Git代码冲突)
在使用git pull拉取服务器最新版本时,如果出现error: Your local changes to the following files would be overwritten by m ...
- Laravel 5.2--git冲突error: Your local changes to the following files would be overwritten by merge:
今天在服务器上git pull是出现以下错误: error: Your local changes to the following files would be overwritten by mer ...
- git pull的时候发生冲突的解决方法之“error: Your local changes to the following files would be overwritten by merge”
今天在使用git pull 命令的时候发生了以下报错 目前git的报错提示已经相关友好了,可以直观的发现,这里可以通过commit的方式解决这个冲突问题,但还是想看看其他大佬是怎么解决这类问题的 在网 ...
- 在Linux上git pull线上仓库代码时,出现error: Your local changes to the following files would be overwritten by merge
在Windows上工作时未出现过该问题,于是通过命令: git diff 查看差异,得到结果: diff --git a/start_crons.sh b/start_crons.sh old mod ...
- Git pull error: Your local changes to the following files would be overwritten by merge:
联合开发,遇上的一个问题,果然,在此验证了百度的不靠谱,是谷歌出的答案...... stackoverflow上有解决方案,链接:http://stackoverflow.com/questions/ ...
随机推荐
- 20190321xlVBA_汇总表按模板生成明细表
Public Sub 汇总表转信息表() '日期 '作者 Next 'QQ 84857038 Dim Wb, Sht, msht, NewSht, rng Set Wb = Application.T ...
- HDOJ-2011
#include<iostream> #include<cstdio> using namespace std; int main(){ int m,n,i; float su ...
- vue 修改 端口号
具体步骤如下: vue小白交流群,希望能够帮助到大家!
- text——文本属性大全
一.文字颜色(color:red;) <style> body {color:red} h1 {color:greenyellow} p.color {color:blue} </s ...
- Netty(一)——Netty入门程序
转载请注明出处:http://www.cnblogs.com/Joanna-Yan/p/7447618.html 有兴趣的可先了解下:4种I/O的对比与选型 主要内容包括: Netty开发环境的搭建 ...
- js获取复选框checkbox选中的多个值
<input type="checkbox" name="idd" value="111" />a <input type ...
- textarea右下角黑点
先记录问题及解决方法,原因后续深入了解 在布局中,用到了textarea 输入框,在Android手机上却显示右下角有一个黑点,检查代码无误,代码没有多余的点符号. 解决:在textarea 中添加 ...
- ssh自动登入
公司的服务器在国外,所以测试的查看日志的时候需要测试机,然后继续ssh 非常不方便,所以编写一个简单的ssh登入脚本 #!/usr/bin/expectset timeout 3spawn ssh n ...
- CTF资料
题目大概有这么几个 web,密码学,pwn(综合渗透),misc(杂项),reverse(逆向),ppc(编程类) 入门: http://bobao.360.cn/ctf/ 360的CTF训练营ww ...
- 在IIS托管服务中设置Rewrite重定向到webapi接口
最近公司遇到这样一个问题.公司以前使用一个SiteServer CMS开源框架来搭建网站,是以asp.net开发的,并且托管在IIS中.其中出现了一个问题,就是用ajax访问不了这个框架后台的weba ...