• Git 本地推送远程失败 non-fast-forward



    To github.com:Yee-Q/yeexang-community.git
     ! [rejected]        dev -> dev (non-fast-forward)
    error: failed to push some refs to 'git@github.com:Yee-Q/yeexang-community.git'
    hint: Updates were rejected because the tip of your current branch is behind
    hint: its remote counterpart. Integrate the remote changes (e.g.
    hint: 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

    错误提示如上,本地项目向远程推送时,提示远程 non-fast-forward,即时本地比远程领先,推送前必须先合并,Git 也给出提示了,要我们先 git pull


    There is no tracking information for the current branch

    这是因为没有指定本地分支与远程分支的关联,可以使用

    git pull origin dev
    

    如果希望一劳永逸,可以使用

    git branch --set-upstream-to=origin/dev
    

    fatal: refusing to merge unrelated histories

    执行 pull 操作时,如果出现这个错误,是由于本地仓库和远程仓库有不同的开始点,也就是两个仓库没有共同的 commit 点而出现的无法提交。这里我们需要用到 --allow-unrelated-histories,也就是我们的 pull 命令改为下面这样的:

    git pull --allow-unrelated-histories
    

    fix conflicts and then commit the result

    pull 操作会自动进行合并,但产生了冲突。一般会有提示是哪个文件产生冲突,找到对应的文件进行修改,再提交一次就行了


  • 相关阅读:
    Vue.js——60分钟组件快速入门(下篇)三
    ASP.NET Core 中的 ORM 之 Dapper
    .Net Core中Dapper的使用详解
    .NetCore与Vue
    Vue 导入文件import、路径@和.的区别
    Git常见命令
    JVM垃圾回收补充知识点
    Java虚拟机垃圾回收(三): 7种垃圾收集器(转载)
    Java虚拟机垃圾回收(二) :垃圾回收算法(转载)
    Java虚拟机垃圾回收:基础点(转载)
  • 原文地址:https://www.cnblogs.com/Yee-Q/p/13769902.html
Copyright © 2020-2023  润新知