[git] Updates were rejected because the tip of your current branch is behind its remote counterpart.
场景
$ 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, 让网络图错综复杂, 十分难观察
git push --force
暴力更新代码, 这样会丢失远端的一些提交(或者代码)git pull ( fetch + merge )
本地取远端修改, 然后合并git pull -- rebase ( fetch + rebase )
本地取远端修改, 然后变基
merge 与 rebase 的区别
merge 是新建一个commit, 在新的commit中, 在两个分支上各取最近祖先至今的修改, 合并, 移动head到最新分支上.
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.的更多相关文章
- Git 报错:Updates were rejected because the tip of your current branch is behind
刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧! 环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错 ...
- (转)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] ...
- 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 ...
- git push时报错:Updates were rejected because the tip of your current branch is behind
出现这样的问题是由于:自己当前版本低于远程仓库版本 有如下几种解决方法: 1.使用强制push的方法: git push -u origin master -f 这样会使远程修改丢失,一般是不可取的, ...
- git提交报错:Updates were rejected because the tip of your current branch is behind
提交代码push时报错:上网查询了一下解决办法有很多种,1.使用强制push的方法:(上网查询说这种会使远程修改丢失,一般是不可取的,尤其是多人协作开发的时候.) git push -u origin ...
- 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 ...
- 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 ...
- 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 ...
- Git出现There is no tracking information for the current branch提示的解决办法
参考:https://blog.csdn.net/sinat_36246371/article/details/79738782 在执行git pull的时候,提示当前branch没有跟踪信息: Th ...
随机推荐
- mac安装phpmysql
1.百度搜“phpmadmin”,还是一样,第二个因为是PC版本,不能用,点击第一个连接,去phpmyadmin的官网. 2.下载完毕后,进入到下载文件保存目录,双击压缩包,压缩包则会自动解压. 3. ...
- centos 下启动 rabbitmq 报错的解决
安装 rabbitmq 后进行了一些配置,然后启动服务: service rabbitmq-server start 无法启动.通过 journalctl -xe 查看日志后,有如下日志: ... - ...
- 使用PYTHON统计项目代码行数
目录 一 使用PYTHON统计项目代码行数 二 应用实例 注:原创不易,转载请务必注明原作者和出处,感谢支持! 一 使用PYTHON统计项目代码行数 遇到一个非常小的需求:统计一个项目里头的各类源代码 ...
- Introduction to statistical learning:with Applications in R (书,数据,R代码,链接)
http://faculty.marshall.usc.edu/gareth-james/ http://faculty.marshall.usc.edu/gareth-james/ISL/
- UNITY3D 添加预制的方法
预制文件(Prefabs)的做法 我这里需要的图片 在hierarchy 视图下新建一个2D object->sprite 然后设置这个sprite的背景为需要的图片 新建一个prefabs目录 ...
- —Entity Framework实例详解
Entity Framework Code First的默认行为是使用一系列约定将POCO类映射到表.然而,有时候,不能也不想遵循这些约定,那就需要重写它们.重写默认约定有两种方式:Data Anno ...
- CRM总结大纲
目录 一. CRM客户关系管理系统 1. CRM是什么? 里面都有哪些功能(业务)? 2. 什么是公户?什么是私户?为什么要做这个区分? 3. 请列举出CRM系统中的表 4. 通过ORM操作对数据库的 ...
- C# WindowService 动态修改服务名
serviceInstaller1中可以设置服务名,描述等 在实际情况中,我们可能需要将Service多开来达到我们的目的,但是安装两次以上会有错误提示,因为服务名已经重复了,这个时候,我们需要动态改 ...
- python 读取文件夹中所有同类型的文件 并用pandas合并
import globimport osimport pandas as pd read_path = 'D:/Data' # 要读取的文件夹的地址read_excel = glob.glob(os. ...
- 抄录的Linux命令
daemon daemon 有一个很高大上的中文名字,叫 守护进程 . 有句话是这么说的,如果 Unix 中没有了守护进程,那么 Unix 就不会是相同的. 它很有个性,是一个运行在后台且不受终端控制 ...