Git的commit your changes or stash them before you can merge
今天用git pull来更新代码,遇到了下面的问题:
error: Your local changes to the following files would be overwritten by merge:
xxx/xxx/xxx.java
Please, commit your changes or stash them before you can merge.
Aborting
但是服务器没有任何手动修改文件行为,很奇怪经常遇到莫名的这类问题
好吧,算啦,直接说最终的解决办法吧
1.stash
通常遇到这个问题,你可以直接commit你的修改;但我这次不想这样。
看看git stash是如何做的。
git stash
git pull
git stash pop
接下来diff一下此文件看看自动合并的情况,并作出相应修改。

git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。

2.放弃本地修改,直接覆盖之
git reset --hard
git pull
通常我直接采取方法2,这样不用考虑缓冲区的清理问题,这种更方便点吧
Git的commit your changes or stash them before you can merge的更多相关文章
- Git 解决方案 commit your changes or stash them before you can merge
error: Your local changes to the following files would be overwritten by merge: *********** Please, ...
- git pull冲突:commit your changes or stash them before you can merge.
今天用git pull来更新代码,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...
- Git冲突:commit your changes or stash them before you can merge.
用git pull来更新代码的时候,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...
- Git冲突:commit your changes or stash them before you can merge. 解决办法
用git pull来更新代码的时候,遇到了下面的问题: 1 2 3 4 error: Your local changes to the following files would be overwr ...
- 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 ...
- git pull和git merge区别&&Git冲突:commit your changes or stash them before you can merge. 解决办法
http://blog.csdn.net/sidely/article/details/40143441 原文: http://www.tech126.com/git-fetch-pull/ Git中 ...
- (转)Git冲突:commit your changes or stash them before you can merge. 解决办法
用git pull来更新代码的时候,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...
- Git提交代码冲突:commit your changes or stash them before you can merge.
用git pull拉取远程分支代码时候遇到如下问题: error: Your local changes to the following files would be overwritten by ...
- Git更新本地仓库及冲突"Commit your changes or stash them before you can merge"解决
Git中从远程的分支获取最新的版本到本地有这样2个命令: 1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge git fetch origin mastergit log ...
随机推荐
- vue--指令中值得随笔的地方
v-model-- 双向数据绑定 number修饰指令 <!DOCTYPE html> <html lang="en"> <head> < ...
- 一颗简单的JDBC栗子
前言:安装好数据库之后,我们编写的java程序是不能直接使用数据库的,而JDBC(Java Database Connectivity,即java数据库连接)是java语言里用来规范客户端程序访问数据 ...
- 【WeX5学习】 后端服务之访问数据库表
WeX5是跨段移动开发框架,将H5的标签封装成组件,实现可视化.组件化快速开发.实现一次开发,多端(iOS.安卓和微信)运行.WeX5的IDE基于Eclipse,提供了一个完全可视化.组件化.拖拽式开 ...
- ABAP,学习不一样的EXCEL导出----XLSX Workbench
这个工具是在查找ABAP导出EXCEL资料的时候发现,是国外的一位大牛自己开发的开源项目,体验了一番,确实很好用. 工具特点: No ABAP Programming Skills are requi ...
- 第三篇:RESTful介绍
在介绍restful之前先放一张从之前文章评论里看到的图,我觉得它把soap和rest之间的一些区别形容地非常形象. 在第一篇和第二篇中我们也介绍过,soap协议传递的报文要基于xml格式的soap消 ...
- DL4NLP——词表示模型(一)表示学习;syntagmatic与paradigmatic两类模型;基于矩阵的LSA和GloVe
本文简述了以下内容: 什么是词表示,什么是表示学习,什么是分布式表示 one-hot representation与distributed representation(分布式表示) 基于distri ...
- docker - 由于docker swarm子网与host机器网络冲突导致的container通信问题的解决方案
背景 近期,公司网络要迁移到新的网段,所以原来在服务器上面搭建的docker swarm需要重新构建... 拿到新的服务器地址看了一下,“10.xxx.xxx.xxx" ... 纳尼,这IP ...
- [javascript] postmessage
摘要 postmessage 作为 html5 跨域传值的解决方法,灰常好用啊..本次用的是页面a 用iframe 嵌入 页面b. 使用方法 postmessage 参数 otherWindow.po ...
- ORA-12516: TNS: 监听程序找不到符合协议堆栈要求的可用处理程”的异常
简单说明:我们开发时多人开发,会频繁访问服务器数据库,结果当连接数大的时候,就会报ora-12516的错误,ORA-12516: TNS: 监听程序找不到符合协议堆栈要求的可用处理程"的异常 ...
- 一种轻便且灵活的js模板的思路
一种轻便且灵活的js模板的思路 项目地址:https://github.com/j20041426/template 思路背景 在Vue.React.Angular等大前端框架异军突起的今天,写前端时 ...