簡體   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