How should I get rid of TFS Branches properly?

I am wondering how I should properly get rid of branches that no longer have any purpose. Right now even if i delete them and commit they are still listed as branches in the properties windows for a particular branching root (directory). If I select merge I don’t get an option to merge to the deleted branch which obviously is as expected but therefore I am puzzled about the branch still showing up in the properties window.

Any explanation on this behavior would be greatly appreciated.

  • git: merging two branches and commits ahead
  • Maintaining a patch set for different branches
  • git fetch doesn't fetch all branches
  • while merging two branches. My files are getting lost
  • How can I have my three website variants (with their deployment directories) as branches in one repository instead of three different ones?
  • Git workflow, differences between devel and production branches on ignoring files
  • What is NOT supported in TFS 2013 Git mode from what is there for TFVC?
  • How do I manage multiple development branches in Git?
  • Can I safely rebase one branch into other and then to master?
  • Git feature branches and minor code improvements
  • Git new file appears in all branches
  • Missing ranges error message when reintegrating a branch into trunk in Subversion 1.5
  • 3 Solutions collect form web for “How should I get rid of TFS Branches properly?”

    I had a situation where a branch had been deleted and there was no purpose for it to stick around. I couldn’t get tf destroy to work until I found out the deletion number of the directory like Damien mentioned. I couldn’t get that ID with tf properties since there was no local copy and no server copy based on the error messages.

    I was able to get the full TFS path by using:

    tf dir $/MyPathTo/TheParent/Directory /deleted

    Then I found the postfixed “;Ident” to the directory and could issue:

    tf destroy $/MyPathTo/TheParent/Directory/TheDirectoryToGetRidOff;Ident

    Damien your answer helped me out – thanks. I thought I’d include the syntax that got me through it to go along with your post.

    The deleted branch is only marked as deleted at a moment in time and it’s possible to still get to the code if you sync to a changeset or time before that delete operation.

    If you do not want to have the file in the branch in the database at all you can use the tf destroy command line:

    As your branch is already deleted you’ll need to use tf dir /deleted to find the deletion number of that branch in order to destroy the files.

    Please use following method to destroy branch in your TFS Project
    you should have permission to delete branch – you should be a part of project collection admin.
    Open Visual Studio Command prompt with admin previlage.
    cd C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE>
    tf destroy $/MyProject/Main/Bin /collection:http://servername:8080/tfs/myproject

    Git Baby is a git and github fan, let's start git clone.