Updates were rejected because the tip of your current branch is behind
最近本地一个flutter项目因为当时使用可视化创建的时候出了一些问题,但是起初没有注意,后来因为需要新增一个语音插件,需要修改原生android MainActivity.java,才发现这个目录根本不存在,于是重新创建一个项目将原来那个项目文件拷入,等修改好后再使用git 连接原来那个项目的github仓库进行代码推送,发现老是提示如下错误
$ git push -u origin master
To https://github.com/dengxiaoning/flutter-trip.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dengxiaoning/flutter-trip.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.
然后又使用pull 仓库代码拉取合并,但是推送任然失败,看有朋友说需要 增加 -f 进行强制拉取,但是试过也没用,最后反过来想来过强制推送看得行不
$ git push -f origin master
Counting objects: 173, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (130/130), done.
Writing objects: 100% (173/173), 1.66 MiB | 5.73 MiB/s, done.
Total 173 (delta 9), reused 38 (delta 4)
remote: Resolving deltas: 100% (9/9), done.
To https://github.com/dengxiaoning/flutter-trip.git
+ d137bd8...0208d12 master -> master (forced update)
一试咦还OK了,不错记录记录。
【注意】在协调时慎用,该参数-f会使用本地项目完全替换掉原仓库的项目,如果本地项目不能保证比远程仓库的完整切勿使用,否则追悔莫及
看看官方介绍
-f--force
Usually, the command refuses to update a remote ref that is not an ancestor of the local ref used to overwrite it. Also, when --force-with-lease option is used, the command refuses to update a remote ref whose current value does not match what is expected.
This flag disables these checks, and can cause the remote repository to lose commits; use it with care.
Note that --force applies to all the refs that are pushed, hence using it with push.default set to matching or with multiple push destinations configured with remote.*.push may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (e.g git push origin +master to force a push to the master branch). See the <refspec>... section above for details.
Updates were rejected because the tip of your current branch is behind的更多相关文章
- (转)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] 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: fai ...
- Git 报错:Updates were rejected because the tip of your current branch is behind
刚开始学习 git 命令,发现会出现很多的错误,所以就总结下出现的错误,以此来加深理解和掌握吧! 环境:在本地库操作了一系列的 add 和 commit 操作后,想把本地仓库推送到远端,但是发生以下错 ...
- 【git报错】hint: Updates were rejected because the tip of your current branch is behind
有时候作为非master权限的项目参与者 在push的时候会遇到这样的报错: hint: Updates were rejected because the tip of your current b ...
- git push时报错:Updates were rejected because the tip of your current branch is behind
出现这样的问题是由于:自己当前版本低于远程仓库版本 有如下几种解决方法: 1.使用强制push的方法: git push -u origin master -f 这样会使远程修改丢失,一般是不可取的, ...
- 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提交报错: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 ...
- 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 ...
随机推荐
- Javaweb基础复习------EL表达式+JSTL-if&foreach
EL表达式------简化JSP页面的Java代码 主要功能是------获取数据(语法:${data}) 举例: //ServletDemo1.java package com.example.se ...
- 小白都能看懂得Xxl-job安装教程
大家好,我是咔咔 不期速成,日拱一卒 一.背景 在平时的业务场景中,经常有一些场景需要使用定时任务,比如: 某个时间点发送优惠券 发送短信等等. 批量处理数据:批量统计上个月的账单,统计上个月销售数据 ...
- 刘勇智:一码通缺陷分析与架构设计方案丨声网开发者创业讲堂 Vol.02
本文内容源自「声网开发者创业讲堂 Vol.02」的演讲分享,分享讲师为 Thoughtworks 专家级咨询师刘勇智.大家可以点击此链接,观看视频回放以及下载讲师 PPT. 从去年年底到现在,随着疫情 ...
- 卡特兰路径和q,t-enumeration 学一半的笔记
目录 卡特兰 The1st q-analogue of \(C_n\) The 2nd q-analogue of \(C_n\) /定义\(C_n(q)\) The q-Vandermonde co ...
- redis.clients.jedis.exceptions.JedisConnectionException: Failed connecting to "xxxxx"
Java 连接 Redis所遇问题 1. 检查Linux是否关闭防火墙,或对外开放redis默认端口6379 关闭防火墙. systemctl stop firewalld 对外开放端口.firewa ...
- MQTT(EMQX) - Java 调用 MQTT Demo 代码
POM <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse ...
- Java高频面试题(2023最新整理)
Java的特点 Java是一门面向对象的编程语言.面向对象和面向过程的区别参考下一个问题. Java具有平台独立性和移植性. Java有一句口号:Write once, run anywhere,一次 ...
- 念一句咒语 AI 就帮我写一个应用,我人麻了...
原文链接:https://forum.laf.run/d/232 作为人类,我们时常会有自己独特的想法和脑洞大开的创意.然而,这些想法往往因为成本过高而无法实现,毕竟每个人的能力和精力都是有限的,尤其 ...
- MQ(消息队列)常见问题梳理
MQ 中 broker 的作用,有无broker有什么差异? MQ(Message Queue)中的broker是消息队列的核心组件之一,它的作用是接收.存储.分发和传递消息.具体来说,broker主 ...
- [网络]NAT与内网穿透技术初探【待续】
1 局域网网段IP 要真正了解NAT就必须先了解现在IPv4地址的使用情况,私有 IP 地址是指内部网络或主机的IP 地址,公有IP 地址是指在因特网上全球唯一的IP 地址.RFC 1918 为私有网 ...