Git pull失败之refusing to merge unrelated histories
来源:互联网 发布:浏览器源码 编辑:程序博客网 时间:2024/05/29 07:19
git pull 失败 ,提示:fatal: refusing to merge unrelated histories
这是因为远程仓库origin上的分支master和本地分支master被Git认为是不同的仓库,所以不能直接合并。
参考http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories。
解决方案:添加--allow-unrelated-histories
假如我们的远程仓库是origin,分支是master,那么我们 需要这样写git pull origin master ----allow-unrelated-histories
附:push和pull命令格式:
git push <远程主机名> <本地分支名>[:<远程分支名>] e.g., git push oschina master, 省略远程分支名,代表推送到有追踪关系的远程分支(一般为同名)
git pull <远程主机名> <远程分支>:<本地分支> e.g., git pull oschina master,省略远程分支名,同理
另外,我发现Pull命令不会删除本地工作区内的“其它文件夹”(即远程仓库没有的文件夹),文件还没试过。
附上经典Git原理图(摘自廖学峰的git教程):工作区就是直接包含本地代码文件的文件夹,stage(或称index)是暂存区(暂存add进来的修改过的代码),commit之后合并到本地仓库的分支(如master)。stage区和本地仓库均存储在.git文件夹内。
阅读全文
0 0
- Git pull失败之refusing to merge unrelated histories
- git pull 失败 ,提示:fatal: refusing to merge unrelated histories
- git pull 失败 ,提示:fatal: refusing to merge unrelated histories
- git pull 失败 ,提示:fatal: refusing to merge unrelated histories
- git pull:refusing to merge unrelated histories
- [GITgit pull 失败 ,提示:fatal: refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git pull报错refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- git pull 错误:refusing to merge unrelated histories
- git无法pull仓库refusing to merge unrelated histories
- Git Pull Failed: fatal: refusing to merge unrelated histories
- git常见问题之git pull origin master时fatal: refusing to merge unrelated histories
- git fatal: refusing to merge unrelated histories
- 连续自然数的阶乘求和
- css中display/visibility和html中hidden的区别
- (8)JavaScript入门
- 规避
- llinux 下查看文件个数及大小
- Git pull失败之refusing to merge unrelated histories
- Review:Microbiota, metagenome, microbiome傻傻分不清
- Unity中的序列化Scriptable
- 程序员面试金典:第K个数、机器人走方格
- 7.18
- 新手上路之 js 创建对象篇 代码笔记
- errno
- HDFS-源码分析(1)-序列化基础
- ImageLoader的简单应用