[英]How do I solve “pushed branch tip is behind” on subtree when deploying to Heroku with Git?
I'm trying to push my build folder, dist-new, with this command:我正在尝试使用以下命令推送我的构建文件夹 dist-new:
git subtree push --prefix dist-new heroku master
Unfortunately, I get this error:不幸的是,我收到此错误:
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'
I can't force the deployment, because git subtree does not have a force option.我无法强制部署,因为 git subtree 没有强制选项。
Googling around, I've seen a recommendation to do this:谷歌搜索,我看到了一个建议:
git push heroku git subtree split --prefix dist master:master --force
But that throws this error:但这会引发此错误:
error: unknown option `prefix'
Does anyone have any ideas?有没有人有任何想法?
You likely aren't using an up to date version of git您可能没有使用最新版本的 git
The prefix option is still available in the latest version of git (see here: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.sh )前缀选项在最新版本的 git 中仍然可用(请参阅此处: https : //github.com/git/git/blob/master/contrib/subtree/git-subtree.sh )
git subtree split -- prefix
Also you need to execute the command as a sub shell you can't just do:您还需要将命令作为子shell执行,您不能这样做:
git push heroku git subtree split --prefix dist master:master --force
You must do:你必须这样做:
git push heroku $(git subtree split --prefix dist master:master) --force
Git Subtree source code: https://github.com/git/git/blob/master/contrib/subtree/git-subtree.sh Git 子树源代码: https : //github.com/git/git/blob/master/contrib/subtree/git-subtree.sh
This worked:这有效:
https://coderwall.com/p/okrlzg/take-control-of-your-heroku-git-repository 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.