为什么我不能推送此最新的Git子树? [英] Why can't I push this up-to-date Git subtree?

查看:47
本文介绍了为什么我不能推送此最新的Git子树?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Git子树与正在处理的几个项目一起使用,以便在它们之间共享一些基本代码.基本代码会经常更新,并且升级可以在任何项目中进行,最终所有项目都将得到更新.

I am using Git subtree with a couple of projects that I am working on, in order to share some base code between them. The base code gets updated often, and the upgrades can happen in anyone of the projects, with all of them getting updated, eventually.

我遇到了一个问题,其中git报告我的子树是最新的,但是推送被拒绝了.例如:

I have ran into a problem where git reports that my subtree is up to date, but pushing gets rejected. For example:

#! git subtree pull --prefix=public/shared project-shared master
From github.com:****
* branch            master     -> FETCH_HEAD
Already up-to-date.

如果我进行推送,我会收到一条消息,说没有任何内容可以推送...对吗?正确的? :(

If I push, I should get a message that there is nothing to push... Right? RIGHT? :(

#! git subtree push --prefix=public/shared project-shared master
git push using:  project-shared master
To git@github.com:***
! [rejected]        72a6157733c4e0bf22f72b443e4ad3be0bc555ce -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:***'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

这可能是什么原因?为什么会失败?

What could be the reason for this? Why is pushing failing?

推荐答案

我在此博客评论中找到了答案 https://coderwall.com /p/ssxp5q

I found the answer on this blog comment https://coderwall.com/p/ssxp5q

如果遇到由于当前分支的提示是 在后面.推送时合并远程更改(例如'git pull')问题(由于 不管是什么原因,特别是git历史记录),那么您就需要嵌套git 命令,以便您可以强制推送到heroku.例如,以上述示例为例:

If you come across the "Updates were rejected because the tip of your current branch is behind. Merge the remote changes (e.g. 'git pull')" problem when you're pushing (due to whatever reason, esp screwing about with git history) then you'll need to nest git commands so that you can force a push to heroku. e.g, given the above example:

git push heroku `git subtree split --prefix pythonapp master`:master --force

这篇关于为什么我不能推送此最新的Git子树?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆