• git push失败


    不知道弄错了什么
    上传项目到github上失败

    git commit的时候提示


    On branch master
    nothing to commit, working tree clean


    git push 时提示

    To https://github.com/Vokiinnn/Scenic_evaluate.git
     ! [rejected]        master -> master (non-fast-forward)
    error: failed to push some refs to 'https://github.com/Vokiinnn/Scenic_evaluate.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.

    百度了一下,用到了这个方法
    git pull origin master --allow-unrelated-histories   
    输入已上命令后,会出现一个文本文档,保存后退出,再次push 成功。。
    原理还未知,先记录一下,以后更新。

    ————————————————————————————————————

    原理:当前的代码和github上的代码冲突了,执行命令后把当前的代码暂时保存,不提交,然后下载GitHub上master分支上的最新代码,再合并当前代码和pull下来的最新代码。

    用 cat   文件名    查看文件的内容。

    合并后的代码如下:<<<<<<<<<  GitHub上的 ========== 本地的 >>>>>>>>

    <<<<<<< HEAD
    git4 add test4
    git6 add test6
    =======
    git4 add test5
    >>>>>>> 044d7590ebcd986df8c3c4539e53b14865b2504f

    合并后直接push的话,会把<<==>>的内容全部push到GitHub,需要对文件进行修改,可以进编辑器修改,也可以直接vim 文件名   进行修改。

    修改后再次push就可以了。

  • 相关阅读:
    OpenGL相关文章
    gluOrtho2D与glViewport
    QOpenGLWidget
    openGL中的gl,glu,glut
    QT对话框
    QT布局
    QT容器类
    [POJ1014]Dividing(二进制优化多重背包)
    [Codefroces401D]Roman and Numbers(状压+数位DP)
    [HDU6326]Monster Hunter(贪心)
  • 原文地址:https://www.cnblogs.com/vokiinnn/p/10731977.html
Copyright © 2020-2023  润新知