Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I get rid of TFS Branches properly?

Tags:

branch

tfs

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.

like image 532
Fadeproof Avatar asked Nov 27 '08 13:11

Fadeproof


People also ask

How do I delete a branch in TFS?

Locate your branch on the branches page. If you don't see it, select All to view all branches and filter the branches using the Search all branches box in the upper right. Select the trashcan icon next to the branch you want to delete.

How do I delete a branch in Visual Studio 2022?

Right-click the branch name and select Delete. Visual Studio will ask if you're sure you want to delete the branch if you have unpublished changes.

How do I delete a branch in TFS 2013?

Simply select a branch, right-click, select Delete, and confirm.


2 Answers

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.

like image 182
Mike Q Avatar answered Nov 10 '22 13:11

Mike Q


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:

http://msdn.microsoft.com/en-us/library/bb386005.aspx

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.

like image 26
Damien Ryan Avatar answered Nov 10 '22 15:11

Damien Ryan