Git冲突:commit your changes or stash them before you can merge.
来源:互联网 发布:测试性能的软件 编辑:程序博客网 时间:2024/05/16 15:05
今天用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 stashgit pullgit 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 --hardgit pull
关于git reset参考这个:
http://www.cnblogs.com/craftor/archive/2012/11/04/2754140.html
关于git reset参考这个:
http://www.cnblogs.com/craftor/archive/2012/11/04/2754140.html
阅读全文
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.
- C# 怎样通过ip和端口向一台设备发送指令
- 安卓 仿微信朋友圈选择图片,拍照,大图预览,删除等功能
- java回调机制
- 【如何快速的开发一个完整的iOS直播app】(点赞功能)
- 搭建ssm框架
- Git冲突:commit your changes or stash them before you can merge.
- 自定义控件之二阶贝塞尔曲线方法详解
- UML学习笔记之状态图
- 安装VirtualBox的时候遇到的问题
- Vue自定义动画和animate.css使用
- css 省略号代码
- 教你实现GPUImage【OpenGL渲染原理】
- UVA
- iOS通过SocketRocket实现websocket的即时聊天