有没有办法删除heroku上的分支

bul*_*ric 6 git deployment heroku ruby-on-rails-3

我正在使用heroku来托管我的应用程序.通过合并和rebase,我有两个不同阶段的应用程序.

本地主人与heroku上的主人不同.

推送到heroku大师失败了:

 ! [rejected]        master -> master (non-fast-forward) 
 error: failed to push some refs to 'git@heroku.com:xxxxx.git'             
 Merge the remote changes (e.g. 'git pull') before pushing again.  See the    
 'Note about fast-forwards' section of 'git push --help' for details.                                                                                 
Run Code Online (Sandbox Code Playgroud)

有没有办法删除heroku主人?然后我可以再次推送给Heroku大师..

Ser*_*sev 21

你可以强迫推

git push --force origin master
Run Code Online (Sandbox Code Playgroud)

这将覆盖远程主控.

您也可以通过执行此操作删除远程分支

git push origin :master
Run Code Online (Sandbox Code Playgroud)

请注意分支名称前的冒号.这个命令说"从本地机器取出,并把它放在远程分支'master'"

  • 删除实际上对 Heroku 不起作用:`! [远程拒绝]主控(预接收挂机拒绝)`。看起来他们通过预接收挂钩明确阻止删除。 (3认同)
  • 我发现他们推荐的*删除*分支的方法实际上是重置整个远程存储库(使用heroku-repo插件中的`repo:reset`)并重新推送您想要保留的分支。他们在 https://help.heroku.com/O0EXQZTA/how-do-i-switch-branches-from-master-to-main 上有相关说明。 (2认同)