Git错误non-fast-forward后的冲突解决
Git错误non-fast-forward后的冲突解决
当要push代码到git时,出现提示:
error:failed to push some refs to ...
Dealing with “non-fast-forward” errors
From time to time you may encounter this error while pushing:
问题(Non-fast-forward)的出现原因在于:git仓库中已经有一部分代码,所以它不允许你直接把你的代码覆盖上去。
于是你有2个选择方式:
1,强推,即利用强覆盖方式用你本地的代码替代git仓库内的内容
git push -f
2,先把git的东西fetch到你本地然后merge后再push
$ git fetch
$ git merge
这2句命令等价于
$ git pull
可是,这时候又出现了如下的问题:
上面出现的 [branch "master"]是需要明确(.git/config)如下的内容
[branch "master"]
remote = origin
merge = refs/heads/master
这等于告诉git2件事:
1,当你处于master branch, 默认的remote就是origin。
2,当你在master branch上使用git pull时,没有指定remote和branch,那么git就会采用默认的remote(也就是origin)来merge在master branch上所有的改变
如果不想或者不会编辑config文件的话,可以在bush上输入如下命令行:
$ git config branch.master.remote origin
$ git config branch.master.merge refs/heads/master
之后再重新git pull下。最后git push你的代码就可以了。
window下cmd里面的命令:
F:\myproject>git config branch.master.remote origin
F:\myproject>git config branch.master.merge refs/heads/master
之后再重新git pull下。最后git push你的代码就可以了。
Git错误non-fast-forward后的冲突解决的更多相关文章
- git branch & checkout fetch 的使用和冲突解决
git branch & checkout fetch 的使用和冲突解决 branch git branch 查看本地分支 git branch -v 查看本地分支的具体信息(commi ...
- Git:非Fast forward下的合并(--no-ff方式的git merge)
创建dev分支,并且修改readme.txt的内容,然后提交 使用git merge --no-ff -m "说明内容" 分支名称合并分支 使用git log --graph -- ...
- Git push错误non-fast-forward后的冲突解决
当要push代码到git时,出现提示: error:failed to push some refs to ... Dealing with “non-fast-forward” errorsFrom ...
- Git错误non-fast-forward后的冲突解决(转载)
文章转载自:http://blog.csdn.net/chain2012/article/details/7476493 当要push代码到git时,出现提示: error:failed to pus ...
- git 本地与远程仓库出现代码冲突解决方法
提交过程中报错: [python@heaven-00 Selesystem]$ git push -u origin masterUsername for 'https://github.com': ...
- mzy git学习,禁用Fast forward的普通合并(六)
git merge --no-ff -m "msg" x-branch:禁用Fast forward的普通合并 通常,合并分支时,如果可能,Git会用Fast forward模式, ...
- Git 分支管理 不使用Fast forward模式进行合并 分支管理策略
通常,合并分支时,如果可能,Git会用Fast forward模式,但这种模式下,删除分支后,会丢掉分支信息. 如果要强制禁用Fast forward模式,Git就会在merge时生成一个新的comm ...
- 【Todo】git的fast forward & git命令学习 & no-ff
git的fast-forward在之前的文章有介绍过,但是介绍的不细: http://www.cnblogs.com/charlesblc/p/5953066.html fast-forward方式就 ...
- Git错误non-fast-forward
Git错误non-fast-forward后的冲突解决 [日期:2012-04-21] 来源:Linux社区 作者:chain2012 [字体:大 中 小] 当要push代码到git时,出现提示 ...
随机推荐
- 遍历Map的两种方法(有排序)
初始化一个map Map<String, String> map = new HashMap<String, String>(); map.put("1", ...
- text-indent:-9999px 字体隐藏问题
为什么要字体隐藏? 通常为了传达更好的视觉效果,我们常用图片替代掉字体.但是为了html语义化,常常要给内容模块加上一些标题来让页面更有意义,在抛开css裸奔的情况下也能很顺利的汲取到页面信息.为此我 ...
- [LintCode] Copy Books 复印书籍
Given an array A of integer with size of n( means n books and number of pages of each book) and k pe ...
- Convert between cv::Mat and QImage 两种图片类转换
在使用Qt和OpenCV混合编程时,我们有时需要在两种图片类cv::Mat和QImage之间进行转换,下面的代码参考了网上这个帖子: //##### cv::Mat ---> QImage ## ...
- 使用ftp软件上传下载php文件时换行丢失bug
正 文: 在使用ftp软件上传下载php源文件时,我们偶尔会发现在本地windows下notepad++编辑器写好的php文件,在使用ftp上传到linux服务器后,php文件的换行符全部丢失了, ...
- tab左右箭头切换
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- SpringMVC下的Shiro权限框架的使用
SpringMVC+Shiro权限管理 博文目录 权限的简单描述 实例表结构及内容及POJO Shiro-pom.xml Shiro-web.xml Shiro-MyShiro-权限认证,登录认证层 ...
- css - float浮动模块的高度问题 解决方案
当一个Div中的子元素都是浮动元素时,该div是没有高度的.通常会带来很多困扰,解决方案如下: 低版本统配兼容: overflow: hidden; 下面是不支持低配浏览器,而且似乎该效果对 P 标签 ...
- 西部数据出现“WD SES Device USB Device”怎么办,而且说明书全是英文。
您好.wd ses device driver这个驱动程序可以在baidu中输入关键词找到,什么驱动之家.驱动人生之类的专业驱动网站也都是有的. western digital的移动硬盘驱动程序安装步 ...
- IOS第12天(3,UIViewController的生命周期)
#import "HMViewController.h" @interface HMViewController () @property(nonatomic,strong)NSA ...