场景

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

原因

远端冲突

解决方案

推荐方案3

因为merge会新建commit, 让网络图错综复杂, 十分难观察

  1. git push --force

    暴力更新代码, 这样会丢失远端的一些提交(或者代码)

  2. git pull ( fetch + merge )

    本地取远端修改, 然后合并

  3. git pull -- rebase ( fetch + rebase )

    本地取远端修改, 然后变基

merge 与 rebase 的区别

  1. merge 是新建一个commit, 在新的commit中, 在两个分支上各取最近祖先至今的修改, 合并, 移动head到最新分支上.

  2. rebase是不新建commit, 首先剪切本分支最近祖先至今的修改, 然后移动head到另一分支. 在另一个分支上, 粘贴刚才的修改, 移动head到最新修改上.

具体详见https://www.jianshu.com/p/c17472d704a0

[git] Updates were rejected because the tip of your current branch is behind its remote counterpart.的更多相关文章

  1. Git 报错:Updates were rejected because the tip of your current branch is behind

    刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧! 环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错 ...

  2. (转)Updates were rejected because the tip of your current branch is behind

    刚创建的github版本库,在push代码时出错: $ git push -u origin masterTo git@github.com:******/Demo.git ! [rejected] ...

  3. 01_第一次如何上传GitHub(转)Updates were rejected because the tip of your current branch is behind

    https://www.cnblogs.com/code-changeworld/p/4779145.html 刚创建的github版本库,在push代码时出错: $ git push -u orig ...

  4. git push时报错:Updates were rejected because the tip of your current branch is behind

    出现这样的问题是由于:自己当前版本低于远程仓库版本 有如下几种解决方法: 1.使用强制push的方法: git push -u origin master -f 这样会使远程修改丢失,一般是不可取的, ...

  5. git提交报错:Updates were rejected because the tip of your current branch is behind

    提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...

  6. git提交时报错:Updates were rejected because the tip of your current branch is behind

    有如下3种解决方法: 1.使用强制push的方法:git push -u origin master -f这样会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候. 2.push前先将远程rep ...

  7. Updates were rejected because the tip of your current branch is behind 问题出现解决方案

    提供如下几种方式: 1.使用强制push的方法(多人协作时不可取): git push -u origin master -f 2.push前先将远程repository修改pull下来 git pu ...

  8. git push ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'https://github.com/Operater9/guest' hint: Updates were rejected because the tip of your current bra

    推送本地代码到github报错 git push报错 ! [rejected] master -> master (non-fast-forward) error: failed to push ...

  9. Git出现There is no tracking information for the current branch提示的解决办法

    参考:https://blog.csdn.net/sinat_36246371/article/details/79738782 在执行git pull的时候,提示当前branch没有跟踪信息: Th ...

随机推荐

  1. DeepLearningBook(中文版)书PDF

    介绍深度学历基础理论.模型和应用.(738页). 第一部分 应用数学与机器学习基础,包括深度学习需要用到的线性代数.概率与信息论.数值计算.机器学习等内容. 第二部分 深度网络:现代实践,包括深度前馈 ...

  2. ant-design-pro中引入bizcharts报错:BizCharts is not defined 解决

    解决方法: 在config.js 中的 externals 配置项中进行了如下配置修改: externals: { '@antv/data-set': 'DataSet', // bizcharts: ...

  3. 连接局域网mysql数据库

    1.先确认mysql服务端端口在防火墙是否开放外网连接(添加): windows防火墙 >高级设置 >入站规则 >新建规则 >选择端口 >添加端口 >后面直接下一步 ...

  4. [spring boot]idea中实现热部署的方法

    发生了任何修改之后,必须关闭后再启动Application类才能够生效,显得略微麻烦. Springboot提供了热部署的方式,当发现任何类发生了改变,马上通过JVM类加载的方式,加载最新的类到虚拟机 ...

  5. Linux系统管理_主题02 :管好文件(1)_2.3 拷贝、剪切、删除和创建文件_cp_mv_rm

    用法:cp [选项]... [-T] 源文件 目标文件 或:cp [选项]... 源文件... 目录 或:cp [选项]... -t 目录 源文件... 将源文件复制至目标文件,或将多个源文件复制至目 ...

  6. Android中为TextView增加自定义的HTML标签

    Android中的TextView,本身就支持部分的Html格式标签.这其中包括常用的字体大小颜色设置,文本链接等.使用起来也比较方便,只需要使用Html类转换一下即可.比如: textView.se ...

  7. Linux学习笔记:shell

    目录 通配符 特殊符号 变量 环境变量 默认变量 shell script case if for until while function 本文更新于2019-08-23. 通配符 *:0个至无穷多 ...

  8. python-Web-django-图表统计

    下载highchart插件包,放在static下 <script src="/static/highcharts/highcharts.js"></script& ...

  9. android#boardcast#发送自定义广播

    广播主要分为两种类型,标准广播和有序广播,通过实践的方式来看下这两种广播具体的区别. 一.发送标准广播 在发送广播之前,我们还是需要先定义一个广播接收器来准备接收此广播才行,不然发出去也是白发.因此新 ...

  10. 【HTML】常用的标签学习(2)

    现在的使用的html语言都是h5,但是h5也是从h4继承发展来的,所以h4的标签我们也要学习,然后加上h5新增的标签,那么html这门语言才算学习完毕.上次学习了h4的一些常用标签,今天学习h4剩下的 ...