gpt4 book ai didi

git - 为什么我不能推送这个最新的 Git 子树?

转载 作者:IT王子 更新时间:2023-10-29 00:32:35 26 4
gpt4 key购买 nike

我正在使用 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.

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

最佳答案

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

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 - 为什么我不能推送这个最新的 Git 子树?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13756055/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com