Git冲突:commit your changes or stash them before you can merge.
来源:互联网 发布:mac下的虚拟机 编辑:程序博客网 时间:2024/06/05 21:09
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.php Please, commit your changes or stash them before you can merge. Aborting
出现这个问题的原因是其他人修改了xxx.php并提交到版本库中去了,而你本地也修改了xxx.php,这时候你进行git pull操作就好出现冲突了,解决方法,在上面的提示中也说的很明确了。
1、保留本地的修改的改法
1)直接commit本地的修改
2)通过git stash
git stashgit pullgit stash pop
通过git stash将工作区恢复到上次提交的内容,同时备份本地所做的修改,之后就可以正常git pull了,git pull完成后,执行git stash pop将之前本地做的修改应用到当前工作区。
git stash: 备份当前的工作区的内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前的工作区内容保存到Git栈中。
git stash pop: 从Git栈中读取最近一次保存的内容,恢复工作区的相关内容。由于可能存在多个Stash的内容,所以用栈来管理,pop会从最近的一个stash中读取内容并恢复。
git stash list: 显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear: 清空Git栈。此时使用gitg等图形化工具会发现,原来stash的哪些节点都消失了。
2、放弃本地修改 的改法
git reset --hardgit pull
阅读全文
0 0
- 处理git commit 冲突 commit your changes or stash them before you can merge.
- 【Git学习笔记】Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge. 解决办法
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- git冲突,commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- git更新文件冲突 Please,commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge. 解决办法
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- Git冲突:commit your changes or stash them before you can merge.
- 二叉树遍历
- USACO Section 1.1 Greedy Gift Givers
- NOI国家集训队论文分类整理
- hdoj1029 Ignatius and the Princess IV(对题目的观察?)
- 梅尔频率倒谱系数(MFCC)教程
- Git冲突:commit your changes or stash them before you can merge.
- 无序广播
- mac安装sonar和使用---上(默认数据库版)
- 处理大并发之五 使用libevent利器bufferevent
- Maven External Dependency
- narray数组操作:数组长度、合并行元素、平方、平方根、list转化为narray
- android系统 Ethernet 解析
- 含有object对象的布局
- tomcat线程池如共有200个,是给其下发布的所有webapps用的,不是每个工程200个线程