问题描述
我正在使用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 [email protected]:***
! [rejected] 72a6157733c4e0bf22f72b443e4ad3be0bc555ce -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:***'
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?
推荐答案
我在此博客评论中找到了答案
I found the answer on this blog comment https://coderwall.com/p/ssxp5q
git push heroku `git subtree split --prefix pythonapp master`:master --force
这篇关于Git子树 - 子树最新,但无法推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!