简体   繁体   English

GIT如果远程丢失,如何删除分支

[英]GIT how to delete branch if remote missing

I have a Rails app that I deployed to Heroku for testing. 我有一个部署到Heroku进行测试的Rails应用程序。 I deleted the Heroku version of the app from the Heroku site. 我从Heroku网站上删除了该应用程序的Heroku版本。

Now, I'm trying to delete the Heroku git branch from my local development and it won't let me because it can't logon to the deleted Heroku app/git. 现在,我试图从本地开发中删除Heroku git分支,但它不允许我,因为它无法登录到已删除的Heroku应用程序/ git。

How can I delete the Heroku git branch? 如何删除Heroku git分支?

Thanks! 谢谢!

Remote tracking branches, the branches that appear in git branch -r with names like heroku/master , are deleted when you delete the remote they belong to: 远程跟踪分支,即出现在git branch -r的分支,其名称如heroku/master ,在删除它们所属的远程对象时将被删除:

git remote rm heroku

(Where "heroku" is the name of the remote you were using to push to heroku.) (其中“ heroku”是您用来推送到heroku的遥控器的名称。)

If you have local branches that you want to get rid of, as well, you can delete those normally with git branch -d (which only succeeds if the branch is already merged in) and git branch -D (which works if it isn't). 如果您还有要摆脱的本地分支,则可以使用git branch -d (仅在分支已经合并的情况下才成功)和git branch -D (如果不是)可以正常删除那些git branch -d 。 t)。

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

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