Please commit your changes or stash them before you merge问题解决
问题描述
error: Your local changes to the following files would be overwritten by merge:
xxx/xxx/xxx.c
Please commit your changes or stash them before you can merge.
Aborting
问题分析
原因是 其他人/或你自己 修改了xxx.c并提交(git add .)到版本库中去了,你本地又想再提交xxx.c,
这时候你进行git pull操作就好出现冲突了,解决方法,在上面的提示中也说的很明确了。进行git commit或者git stash操作。
解决办法
1、保留本地的修改 的改法
1)直接git commit本地的修改 ——一般不推荐这种方法,因为可能你还想修改该文件
2)通过git stash——通常使用该方法
git stash
git pull
git stash pop
步骤解析:
git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git pull 或者 git pull <remote> <branch>:拉取代码
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
此外还有:
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。
2、放弃本地修改 的改法 ——这种方法会丢弃本地修改的代码,而且不可找回
git reset --hard
git pull
Over....
Please commit your changes or stash them before you merge问题解决的更多相关文章
- 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冲突解决】: Please commit your changes or stash them before you merge.
刚刚使用 git pull 命令拉取代码时候,遇到了这样的问题: error: Your local changes to the following files would be overwritt ...
- commit your changes or stash them before you can merge
今天用git pull来更新代码,遇到了下面的问题: 今天git pull 出现以下问题 Please commit your changes or stash them before you mer ...
- 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来更新代码的时候,遇到了下面的问题: error: Your local changes to the following files would be overwritten by ...
- Your local changes to the following files would be overwritten by merge: ... Please, commit your changes or stash them before you can merge
Git出现error: Your local changes to the following files would be overwritten by merge: ... Please, com ...
- 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 解决方案 commit your changes or stash them before you can merge
error: Your local changes to the following files would be overwritten by merge: *********** Please, ...
随机推荐
- Docker-常用基建的安装与部署
一:Docker安装 1:通过yum安装docker yum -y install gcc yum -y install gcc-c++ yum remove docker \ docker-clie ...
- CVE-2018-1273 Spring Data Commons 远程命令执行漏洞复现
一.漏洞描述 Spring Data是一个用于简化数据库访问,并支持云服务的开源框架,Spring Data Commons是Spring Data下所有子项目共享的基础框架.Spring Data ...
- MySQL数据库基础知识及优化
MySQL数据库基础知识及优化必会的知识点,你掌握了多少? 推荐阅读: 这些必会的计算机网络知识点你都掌握了吗 关于数据库事务和锁的必会知识点,你掌握了多少? 关于数据库索引,必须掌握的知识点 目录 ...
- 庐山真面目之十一微服务架构手把手教你搭建基于Jenkins的企业级CI/CD环境
庐山真面目之十一微服务架构手把手教你搭建基于Jenkins的企业级CI/CD环境 一.介绍 说起微服务架构来,有一个环节是少不了的,那就是CI/CD持续集成的环境.当然,搭建CI/CD环境的工具很多, ...
- Centos7 添加用户及设置权限
一.添加用户 1.登录root 用户 [gau@localhost /]$ su Password: # 输入密码 [root@localhost /]# 2.添加用户 [root@localhost ...
- 小白也能看懂的ACID与隔离级别
前言 现如今JAVA开发工程师的数量越来越多,但大多数工程师平时做的工作都是简单的CRUD,当你一直处于这种舒适的环境中不追求进步的时候,如果哪一天你突然想要改变环境,换个工作,去与面试官当面聊技术的 ...
- centos 7.0 ping百度提示:ping: www.baidu.com: Name or service not known
解决方法一: 添加dns服务器 vi /etc/resolv.conf 在文件中添加如下两行: nameserver 8.8.8.8 nameserver 8.8.4.4 保存退出,重启服务器.之后再 ...
- Java SPI机制详解
Java SPI机制详解 1.什么是SPI? SPI 全称为 (Service Provider Interface) ,是JDK内置的一种服务提供发现机制.SPI是一种动态替换发现的机制, 比如有个 ...
- http发送
package cn.com.yitong.wdph.util; import java.io.BufferedReader;import java.io.InputStream;import jav ...
- 洛谷 P1401 城市
写在前面 今天来水主题库里的有水分的紫题,随便一翻竟然找到宝了. 小清新二分 + 网络流. 算法思路 考虑到题目中限制的是最大边权,要求最大边权最小,那么很容易想到二分答案. 单调性的证明:最大边权是 ...