繁体   English   中英

使用 Git 部署到 Heroku 时,如何解决子树上的“pushed branch tip is behind”?

[英]How do I solve “pushed branch tip is behind” on subtree when deploying to Heroku with Git?

我正在尝试使用以下命令推送我的构建文件夹 dist-new:

git subtree push --prefix dist-new heroku master

不幸的是,我收到此错误:

error: failed to push some refs to 'https://git.heroku.com/it
ribe-frontend.git'
hint: Updates were rejected because a pushed branch tip is be
hind its remote
hint: counterpart. Check out this branch and integrate the re
mote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help'

我无法强制部署,因为 git subtree 没有强制选项。

谷歌搜索,我看到了一个建议:

git push heroku git subtree split --prefix dist master:master --force

但这会引发此错误:

error: unknown option `prefix'

有没有人有任何想法?

问题

您可能没有使用最新版本的 git

解决方案

前缀选项在最新版本的 git 中仍然可用(请参阅此处: https : //github.com/git/git/blob/master/contrib/subtree/git-subtree.sh

git subtree split -- prefix

您还需要将命令作为子shell执行,您不能这样做:

git push heroku git subtree split --prefix dist master:master --force

你必须这样做:

git push heroku $(git subtree split --prefix dist master:master) --force

参考

Git 子树源代码: https : //github.com/git/git/blob/master/contrib/subtree/git-subtree.sh

这有效:

https://coderwall.com/p/okrlzg/take-control-of-your-heroku-git-repository

$ heroku plugins:install https://github.com/lstoll/heroku-repo.git
$ heroku repo:reset -a appname

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM