最近本地一个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的更多相关文章

  1. (转)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] ...

  2. 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 ...

  3. [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 ...

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

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

  5. 【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 ...

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

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

  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提交报错:Updates were rejected because the tip of your current branch is behind

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

  9. 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 ...

  10. 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 ...

随机推荐

  1. MySQL学习(四)锁机制

    分类 读锁(共享锁):对同一个数据,多个读操作可以同时进行,互不干扰 写锁(互斥锁):如果当前写操作没有完毕,则无法进行其他的读操作.写操作 操作范围 表锁:一次性对一张表整体加锁.如myisam存储 ...

  2. Activiti7开发(一)

    0.前言 开发背景 项目开发设计审批工作流,企业微信的审批不错,但是下拉列表不支持后期添加,所以只能自己实现,通过gitee查找相关工作流的开源项目,参考有 闲鹿(RuoYi+Activiti6) h ...

  3. 全网最详细中英文ChatGPT接口文档(二)30分钟开始使用ChatGPT——快速入门

    目录 Quickstart 快速启动 Introduction 导言 1 Start with an instruction 从说明开始 2 Add some examples 添加一些示例 3 Ad ...

  4. 商城网站毕业设计( Python +Vue)

    网站介绍 基于 python 开发的电子商城网站,平台采用 B/S 结构,后端采用主流的 Python 语言进行开发,前端采用主流的 Vue.js 进行开发.这是给师弟开发的毕业设计. 整个平台包括前 ...

  5. 剑指 offer 第 8 天

    第 8 天 动态规划(简单) 剑指 Offer 10- I. 斐波那契数列 写一个函数,输入 n ,求斐波那契(Fibonacci)数列的第 n 项(即 F(N)).斐波那契数列的定义如下: F(0) ...

  6. SaaS、PaaS、IaaS区别

    SaaS SaaS 越久,觉得它个庞大的领域 SaaS 收入的"长江流域". 传统软件像买房:什么都得自己买,价格昂贵,一般人用不起.SaaS模式就像是租赁预先装修好的共享公寓,拎 ...

  7. 用 Go 剑指 Offer 11. 旋转数组的最小数字

    已知一个长度为 n 的数组,预先按照升序排列,经由 1 到 n 次 旋转 后,得到输入数组.例如,原数组 nums = [0,1,4,4,5,6,7] 在变化后可能得到:若旋转 4 次,则可以得到 [ ...

  8. 深入理解 python 虚拟机:字节码教程(1)——原来装饰器是这样实现的

    深入理解 python 虚拟机:字节码教程(1)--原来装饰器是这样实现的 在本篇文章当中主要给大家介绍在 cpython 当中一些比较常见的字节码,从根本上理解 python 程序的执行.在本文当中 ...

  9. 四月二十六java基础知识

    1..对文件的随机访问:前面介绍的流类实现的是磁盘文件的顺序读写,而且读和写分别创建不同的对象,java语言中还定义了一个功能强大.使用更方便的随机访问类RandomAcessFile它可以实现文件的 ...

  10. pandas操作excle

    Python是一门强大的编程语言,也是数据科学领域中最流行的语言之一.在处理数据时,很多时候需要与Excel进行交互,以进行数据读取.清理和分析.Python中有很多工具可以与Excel进行交互,其中 ...