今天用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相关推荐

  1. 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 ...

  2. Git commit your changes or stash them before you can merge

    今天用git pull来更新代码,遇到了下面的问题: qrh$ git pull -a Updating bebc9d4..32e538a error: Your local changes to t ...

  3. Git pull时报错:commit your changes or stash them before you can merge. 的解决办法

    Git pull时报错:commit your changes or stash them before you can merge. 的解决办法 今天在pull的时候,报错,信息如下: error: ...

  4. commit your changes or stash them before you can merge 解决方法

    在git提交过程中,commit your changes or stash them before you can merge 是一个常见的问题(如下图). 问题:在你merge or change ...

  5. commit your changes or stash them before you can merge

    今天用git pull来更新代码,遇到了下面的问题: 今天git pull 出现以下问题 Please commit your changes or stash them before you mer ...

  6. Git更新本地冲突:commit your changes or stash them before you can merge。。。

    从git仓库pull源码到本地时,提示本地冲突错误 英文阅读水平还ok,通过万能的有道翻译如下:"错误:您对以下文件的本地更改将被合并覆盖,请在你可以合并之前,提交你的修改或者隐藏它们&qu ...

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

    在你pull的时候发现pull失败,因为本地有修改,所以有两种解决方式: 1. 将修改暂存,保留修改 git stash //暂存当前正在进行的工作. git pull //拉取服务器的代码 git ...

  8. 使用TortoiseGit pull时,提示Please, commit your changes or stash them before you can merge.

    这是代码冲突导致的. 解决:点击项目 右键选择 stash save(把自己的代码隐藏存起来) -> 重新pull -> stash pop(把存起来的隐藏的代码取回来 ) -> 代 ...

  9. Git冲突:Please commit your changes or stash them before you merge

    当执行 git pull 命令时,提示错误如下: Updating bb954c5..02de6f1 error: Your local changes to the following files ...

  10. git 只commit不push 会有影响吗_规范化团队 git 提交信息

    规范化团队 git 提交信息 同一个工程项目,为了方便管理,git 的 commit 信息最好按照一定的格式规范,以便在需要的时候方便使用.什么是方便的时候,比如出现了一个线上 bug,所以需要回滚操 ...

最新文章

  1. 沁恒RISC-V MCU 为全国大学生智能汽车竞赛加速
  2. mysqlbinlog 恢复mysql数据
  3. android Button源码分析
  4. 数据库实时转移之Confluent介绍(一)
  5. 当一个事情过度的艳丽的时候就是一个衰败的开始
  6. java 远程udp_远程客户端不接收UDP数据包
  7. 【leetcode】910. Smallest Range II
  8. MDK升级后的头文件冲突
  9. MySQL 高级 —— MVCC 多版本并发控制
  10. 深度学习(三十一)基于深度矩阵分解的属性表征学习
  11. 大型综合体弱电智能化解决方案标书
  12. html5实验原理,HTML5 方块碎片化实验
  13. 自然语言处理跟踪研究
  14. 09月28日 pytorch与resnet(三)预训练的Mask R-CNN 模型进行微调
  15. 【计算机体系结构】实验4指令调度与分支延迟
  16. linux添加一块20G的scsi硬盘,Linux下添加第二块scsi硬盘.doc
  17. 论文笔记:主干网络——SENet
  18. 学习笔记(2)——TransE算法(Translating Embedding)
  19. 嵌入式程序员的几年的小心得
  20. 无线Mesh网络简介

热门文章

  1. android 十六进制string转int,16进制string转成int
  2. python 执行文件的扩展名_python脚本文件的扩展名是什么
  3. android u盘加载_如何获取Android系统挂载U盘的路径
  4. 错误代码1500什么意思_为什么藏族可以吃牦牛肉?(笑cry~
  5. 纸筒制作机器人_趣味STEAM教育:如何用“垃圾”制作机器人?
  6. 创建一个基于Spring IO Platform的多模块Gradle项目
  7. JSF+Spring+Hibernate整合要点
  8. 【转参考】MySQL利用frm和ibd文件进行数据恢复
  9. 第二阶段—个人工作总结02
  10. 如何在app应用中添加支付宝支付功能(解惑版)