How do I remove deleted Git branches from Visual Studio 2015

前端 未结 3 2071
面向向阳花
面向向阳花 2021-02-18 17:27

Visual Studio continues to show any branch I\'ve pulled, even after that branch has been deleted (and I do not have it as the selected branch).

  • \"git fetch -
相关标签:
3条回答
  • 2021-02-18 18:09

    Visual Studio 2015 & 2017

    1. Open up Team Explorer and go to the Branches view.
    2. Locate the branch you want to delete. Make sure that you aren't checked out to that branch-you can't delete the branch you are currently working in.
    3. Right-click the branch name and select Delete. If you have unpublished changes, Visual Studio will ask and make sure you want to delete the branch so you don't possibly lose work
    0 讨论(0)
  • 2021-02-18 18:26

    prune is about removing any remote-tracking references that no longer exist on the remote.

    So if the branch still exists on the remote side, it won't be deleted locally.

    If the branch is deleted locally (with Visual Studio), its remote tracking instance will still be re-created at the next push.

    You need to make sure the branch is also deleted on the remote side:

    git push origin --delete abranch
    
    0 讨论(0)
  • 2021-02-18 18:32

    I had remote branches that would not go away even after they were deleted on the server. This tip about setting "Prune remote branches" worked for me. I found it here.

    Go to Team Explorer, and click Home button. Then Settings > Repository Settings, and set "Prune remote branches during fetch" drop-down to True. Don't forget to click "Update" button to save your edit.

    After changing the setting I did a fetch on one of the deleted branches and all of the deleted branches disappeared.

    0 讨论(0)
提交回复
热议问题