git pull的时候发生冲突的解决方法之“error: Your local changes to the following files would be overwritten by merge”
今天在使用git pull 命令的时候发生了以下报错

目前git的报错提示已经相关友好了,可以直观的发现,这里可以通过commit的方式解决这个冲突问题,但还是想看看其他大佬是怎么解决这类问题的
在网上查了资料和其他大佬的博客,得到了两种解决方法:
方法一、stash
git stash
git commit
git stash pop
接下来diff一下此文件看看自动合并的情况,并作出相应修改。
git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。
方法二、放弃本地修改,直接覆盖
git reset --hard
git pull
参考原文:https://blog.csdn.net/lincyang/article/details/21519333
git pull的时候发生冲突的解决方法之“error: Your local changes to the following files would be overwritten by merge”的更多相关文章
- 解决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: ... 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文件冲突合并的报错:Your local changes to the following files would be overwritten by merge
记录一下在项目里使用git遇到代码冲突时的解决方法 问题:当我和我同事两个人改了相同的一个文件,他在我提交前提交了,这时候我就提交不了了,并且也pull不下来他的代码 会报错: Your local ...
- 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: Your local changes to the following files would be overwritten by merge:XXXX
版权声明:这可是本菇凉辛辛苦苦原创的,转载请记得带上我家地址,不要忘记了哈 ... https://blog.csdn.net/u011314442/article/details/78852547 ...
- 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 stash git pull origin master git stash po ...
- git pull遇到错误:error: Your local changes to the following files would be overwritten by merge:
方法1:如果你想保留刚才本地修改的代码,并把git服务器上的代码pull到本地(本地刚才修改的代码将会被暂时封存起来) git stash git pull origin master git sta ...
随机推荐
- Java Predicate
Predicate 接口说明 /* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * O ...
- jieba库的使用
jieba库的使用 jeiba库是一款很优秀的用于中文分词的第三方库,它通过一个汉词词典来确定汉字之间的关联概率,将概率较大的组成分词. 精准模式 把文本精准的分割开来,不存在冗余单词. jieba. ...
- Zookeeper3.4.14集群搭建
环境: 3台centos7.4 1. 下载release:wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3. ...
- 二 shell 基础
一 文件的 权限基础 文件有三类权限 user,group,other, 权限分为 r w x 代表数字分别为 4 2 1 修改权限命令 chmod 权限还有特殊权限,在执行的时候代表某一身 ...
- 8VC Venture Cup 2017 - Elimination Round - B
题目链接:http://codeforces.com/contest/755/problem/B 题意:给定PolandBall 和EnemyBall 这2个人要说的单词,然后每一回合轮到的人要说一个 ...
- TCP和UDP的区别,以及它们对应的协议有哪些?
TCP(传输控制协议) 是面向连接的协议.在收发数据前,一个TCP连接必须要经过“三次握手”建立可靠的连接.握手过程中传送的包里不包含数据,三次握手完毕后,客户端与服务器才正式开始传送数据.理想状态下 ...
- python request post请求body中有json数组
今天被这个卡了好久,最后解决发现是个小问题,哈哈 记录: 用request发送post请求,原来当body都是普通的字符串和数字时一切顺利,今天遇到了body里面有json数组,结果就是报参数错误 解 ...
- jenkins部署github项目持续集成
一.先介绍正向代理和反向代理 正向代理 反向代理 二.安装反响代理得到固定域名 http://www.xiaomiqiu.cn/ 三.Jenkins与Github集成 配置前要求: 1.Jenkins ...
- Dataphin的代码自动化能力如何助力商业决策
前言 随着大数据趋势的迅速增长,数据的重要性与日俱增,企业内看数据.用数据的诉求越来越强烈,其中最常见的就是各种经营报表数据:老板每日早晨9点准时需要看到企业核心的经营数据,以便进行企业战略及方向决策 ...
- mybatis 动态Sql的模糊查询
where teacher.tname like concat(concat(#{tName}),'%') 2:distinct的使用 下面先来看看例子: table id name 1 ...