简体   繁体   English

如何从我的本地 git 存储库中删除对远程分支的引用

[英]How to remove references to remote branches from my local git repository

When I type git branch in my local repository, I get this:当我在本地存储库中键入git branch时,我得到以下信息:

* master
  minor/branch_1
  origin&minor/branch_2
  origin/minor/branch_2

How can I remove the last two references from my local repository without affecting the remote one?如何在不影响远程存储库的情况下从本地存储库中删除最后两个引用?

git branch without options should only show local branches and shouldn't include remote-tracking branches. git branch应该只显示本地分支,不应该包括远程跟踪分支。 Are you sure those are not local branches with awkward names?你确定那些不是名字笨拙的当地分支机构吗? If so, delete them like any other local branch:如果是这样,请像删除任何其他本地分支一样删除它们:

git branch -d 'origin&minor/branch_2' 'origin/minor/branch_2'

If they are unmerged branches, use -D .如果它们是未合并的分支,请使用-D Note that this will make the commits of the branches unreachable and they will eventually be fully deleted from your Git repository请注意,这将使分支的提交无法访问,并且它们最终将从您的 Git 存储库中完全删除

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

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