Git子树 - 子树最新,但无法推送 [英] Git subtree - subtree up-to-date but can't push

查看:109
本文介绍了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天全站免登陆