Muflix
Muflix

Reputation: 6798

Cant create a branch from a TFS project

I started using TFS and I was not using branches for my project, but now I need to manage releases, so my Idea is to make Branch from the project and for every release create new branch from the main branch.. so

In VS2015 Source Control Explorer, i click on TFS project > Branching and Marging > Convert To Branch and this error happened

TF203028: You cannot create a branch at $/ProjectA because a branch alreadyexists at $/ProjectA/Main. If $/ProjectA/Main is not a branch convert it back to a folder and retry the operation.

the problem is that I don't see any branches in source control manager neither in TFS website, I created empty branch earlier but I deleted it. What to do ? I don't want to create new project with Main branch and copy/paste the source codes because I want to preserve the commits.

Upvotes: 1

Views: 1286

Answers (2)

T.S.
T.S.

Reputation: 19350

Potential scenario

Lets say you have branch

$/project1/Folder/subfolder/branch1/source

You've decided that you need to have

$/project1/Folder/branch2/source

In this case, first you move the source under subfolder and now you have 2 items

$/project1/Folder/subfolder/branch1 
$/project1/Folder/subfolder/source

You say, ok, "I can now delete branch1". Delete it and You get

$/project1/Folder/subfolder/source

All you have to do now is rename subfolder to branch2 and convert it to branch. And this is where you get this error TF203028: You cannot create a branch at...

The solution is - in the Source Control Explorer, press button "Show/Hide Deleted Items" to view deleted items, find the deleted branch1 and convert it to folder using menu "Branching and Merging". Once deleted branches eliminated under your new branch folder, you will be able to convert folder branch2 to branch. And you don't need tf destroy to achieve this result.

Upvotes: 1

Paul Michaels
Paul Michaels

Reputation: 16695

In TFS, you never really delete anything. In fact, if you look under Tools -> Options -> Source Control -> Team Foundation Server, there is an option to show deleted items:

Team Foundation Source Control Settings

To actually delete an item, have a look at the tf destroy command.

I believe that you can simple rename the folder, and that will maintain your history, should you not wish to permanently delete the old branch.

Upvotes: 3

Related Questions