最佳答案
为了在它们之间共享一些基本代码,我正在使用 Git 子树和我正在开发的几个项目。基本代码经常得到更新,并且升级可以发生在任何一个项目中,最终所有项目都会得到更新。
我遇到了一个问题,git 报告说我的子树是最新的,但是推送被拒绝了。例如:
#! git subtree pull --prefix=public/shared project-shared master
From github.com:****
* branch master -> FETCH_HEAD
Already up-to-date.
如果我推,我会得到一个消息,没有什么可以推... 对吗? 对吗? : (
#! 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.
原因是什么? 为什么推动会失败?