简体   繁体   中英

How to remove references to remote branches from my local git repository

When I type git branch in my local repository, I get this:

* 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. 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 . Note that this will make the commits of the branches unreachable and they will eventually be fully deleted from your Git repository

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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