How do I branch? - tfs

https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/branching-strategies-with-tfvc?view=azure-devops
I have a brand new project in Azure DevOps. There's nothing in it yet, but I want to set up the branches to model the Servicing, Hotfix, Release isolation strategy from the link above.
To do this, I need a branch, and a branch of a branch.
When I right click my project and say "Branch", it prompts for a Target.
This is where everything I try does not work.
First thing I tried was to use $/Master/HotFix. This returns an error "The target item $/Master/HotFix cannot be under the source item $/Master.
Then, I tried just $/Master-HotFix and get an error "Source control must branch into an existing team project. Master-HotFix is not a team project"
So, I went to Azure DevOps and I created a new project called Master-HotFix. I mapped it in Visual Studio, and tried again. This time, I got the error "Unsupported pending change attempted on team project folder $/Master-HotFix. Use the Project Creation Wizard in Team Explorer to create a project.
Surely making a branch isn't this difficult? What am I missing?

According to your description, seems you get promoted a kind of below dialog
I have a brand new project in Azure DevOps. There's nothing in it yet
You are trying to branch a Team Project rather than a folder containing your code.
You should first have your code in a folder, say "Master", under the "$/TeamProject/" folder. You can then branch "$/TeamProject/Master" to "$/TeamProject/Master/child".
If you have dumped all of your code into the root of your team project then you will need to move it into a folder first, then branch that folder.
warning: You can create a new team project that is a branch of this one, giving you "$/Master". However this method is a terrible idea and will lead to pain and suffering
For more details please refer our official tutorial:
Convert a Folder to a Branch
Branch a folder or file

In order to branch in TFVC you first need to create you master/MAIN branch as a folder. Then you check that folder in. After you can convert it to a branch from the branch menu. After that you'll be able to branch off that master/MAIN branch and create the structure you are trying to do.
Cheers,
ET

Related

Why cant I branch a TFS project?

Its driving me crazy already, I have a folder converted into a branch, when I try to branch this one, the dialog suggests a name, which I accept, then after confirming that I really want to branch I get the nice error message:
TF10175: The MYPROJECT-branch team project does not exist.
Althoug the branch dialog clearly states: "The new branch will be created and commited as single operation"
Ok, so, when I branch to a existing but empty folder (converted to a branch according the MS doc) I get the opposite message:
The item $/MYPROJECT-TEST already exists.
So what is it now? It really drives me crazy. I just cant branch this damn project.
Please follow these steps to delete the workspace:
In "Team Explorer" select "Pending Changes"
Beside the "Check In" button click on "Actions" and select "Manage Workspaces…"
Select the Workspace and press "Remove"
Then follow these steps to branch a TFS project
when I branch to a existing but empty folder
We cannot specify an existing folder as a target. It will create a new folder based on the target path you entered, we should branch to a folder that does not exist. Then we can convert the folder to a branch via the button convert to branch.
Steps:
a.
b. Check in the new folder
c. Convert the folder test to branch:
Update1
Branch a TFVC project
Steps:
Select the TFVC project and convert the project to branch via the button Convert to branch.
Branch the TFVC project to an existing project repository folder.
Note: The target folder should not exist until the branch is completed. And we just can branch the project to another project repo folder.

TFS - Branching

I am doing to for the first time so I want to use Release isolation strategy for our project using TFVC. I went over documentation on how to do that but I was unable to branch out our projects. We have two projects which are dependent on each other and structure of those projects looks like this:
Project 1
folder 1
folder 2
folder 3
I tried to convert project itself to branch and then branching it out but it gives me an error saying TF10175: ... Team project does not exist. Then I tried to create one main folder inside the project and convert that folder into branch and then branch it out but reorganizing folders causing build issues. Do you have any advice how I could branch my projects out and why am I getting team project does not exist issue. Do I need to create new project in TFS called XYZ-branch?

TFS Branching / Versioning Basics

I am very new to TFS. I have below Structure where I have my entire SOLUTION checked into my TFS online Repository.
Now, we are done with this Feature/Version.
What we want to do is...Leave this version AS IS and create a new Version / Branch out of this. This way if we ever have to go back to this version we can easily go back to it.
But Whenever I right Click on Root and Choose "Branch" Then I get an error that "The Bracnh Already Exists". I would like to name the new Branch "Release 2.0" or Something. But I cant Branch out my current Solution.
Creating New Folder option is Disabled.
Why is it disabled? I have full access to TFS/
You can't branch from the team project root. Reorganize everything to be in a trunk folder (TFVC convention is main, but you can call it whatever you want), and branch off of that.
For what it's worth, branches shouldn't be infinitely branching -- you should branch off of a trunk to do development, then merge back in when development is done. There are numerous reasons why this is the case, but I suggest doing some reading on TFVC branching strategies to find one that's appropriate for your organization.

Is there a way to start a branch (based on a label) in the root of a team project?

I'm in the following situation with TFS 2010:
I have a team project (with 2 sub-folders of source code).
The team project has no branches but has been labelled in the past.
I need to create a branch in the root of the team project, based on a specific (and historic) label.
I have tried this method (all in Source Control Explorer):
Right-click team project and go to Branch...
Change Target to $/MyTeamProject/NewBranchName
Choose appropriate label.
Uncheck "Convert source and target folders to branches".
When I click OK I receive this error:
The target item $/MyTeamProject/NewBranchName cannot be under the
source item $/MyTeamProject.
Any ideas?
PS. I was able to branch the label into a different team project, but that doesn't solve my problem.
My guess is that the item $/MyTeamProject is included in your label, then TFS can't create a branch under that path.
So edit the label and remove the $/MyTeamProject path and try again.
EDIT :
You can only remove a folder using the TFS Sidekicks.
The problem is that you are trying to create a branch under the root of the branch you are branching from. That is, by right-clicking on the team project and selecting branch, you cannot create a branch under that team project.
Instead, try the branch operation from the folders. That will allow you to place them under the team project. If you want them to have a single common root, you will likely need to branch them separately into a subfolder under the team project.

TFS2010, is it possible to create a branch retroactively?

Been using TFS2010 for just a few months now so relative newbie, and now possibly need to create my first branch, unfortunately I need to create it from an older changeset, is this possible?
Basic scenario is I converted a project from VSS 6.0, with history, and it all came over fine. Project has approx 500 source files.
Before the conversion from VSS we started working on version 4.0 of our project, with no plans to release any more bug fixes to 3.1 so we didn't establish any branches at that time.
So we have made significant changes to about 20 files (which I can identify), but now the client wants to release a 3.11, 3.2, 3.3 etc because not everyone will be ready to go to 4.0 product anytime soon.
I think we want to create a branch, and then use TFS to rollback about 20 files in that branch to an older version, is this possible to do? Create a branch from where we are now, and then rollback some of the files? or does creating a branch cause you to lose history for that branch?
Slightly complicating things is that after we started working on 4.0, besides making the 4.0 specific changes we also have several changes that we made that would need to go into both he 3.1 branch AND stay in the 4.0 branch we are working on now, and furthermore, and more bug fixes we need to put in over the next several months would need to apply to both branches.
Perhaps this is a pretty straight-forward use case for TFS, but just wanted to make sure I don't mess up what is already working perfectly fine.
Suggestions?
You can create a branch from any changeset, and it's very easy from within the Source Control Explorer UI. Just navigate with Source Control Explorer to the server path you want to branch, select branch, and then you'll be given the option to "Branch From Version". Just select whatever changeset you want to branch from and your new branch will be created from that instead of the default of the latest version.
Why don't you choose to get the appropriate base version with "Get Specific Version" which will summon the sources in the state you need - of your version 3.1.
Then construct a branch to continue work towards 3.1x
Executing 'Get Latest' on your base branch should result with your sources in version 4.0
I have just done this.
I started my solution with a single branch team project in codeplex :
-MyPrettyCMS/Database
-MyPrettyCMS/Framework
-MyPrettyCMS/Layers
-MyPrettyCMS/Portals
-MyPrettyCMS/Solution
It's not possible to create a branch of the team project
WARNING ! I tryed to convert Team Project folder to a Branch, it worked but after that, I can't create any branch and I had not enough rights to undo that (I had to ask the Code Plex TFS Administrator to undo for me).
All of this must be done with team explorer and not with solution explorer.
So I created a Team project folder subfolder CurrentRelease like this
-MyPrettyCMS/Database
-MyPrettyCMS/Framework
-MyPrettyCMS/Layers
-MyPrettyCMS/Portals
-MyPrettyCMS/Solution
-MyPrettyCMS/CurrentRelease
Then, for each folder I used the team explorer move command (DON'T MOVE FOLDERS with the Windows explorer even if you have the plug in, because sometimes it fails).
The result is
-MyPrettyCMS/CurrentRelease/Database
-MyPrettyCMS/CurrentRelease/Framework
-MyPrettyCMS/CurrentRelease/Layers
-MyPrettyCMS/CurrentRelease/Portals
-MyPrettyCMS/CurrentRelease/Solution
At this point you must archive each CurrentRelease subfolder
Now you open windows explorer and you verify each folder and its descendent to see if you forgot some files. If you did, copy it to the new folder, add it to archive with the Add files of Team Explorer. You must archive again.
Right click on MyPrettyCMS/CurrentRelease ans select command create a branch
I used CurrentRelease-To-2-50-001 as Branch name
Then I have
-MyPrettyCMS/CurrentRelease/Database
-MyPrettyCMS/CurrentRelease/Framework
-MyPrettyCMS/CurrentRelease/Layers
-MyPrettyCMS/CurrentRelease/Portals
-MyPrettyCMS/CurrentRelease/Solution
and
-MyPrettyCMS/CurrentRelease-To-2-50-001/Database
-MyPrettyCMS/CurrentRelease-To-2-50-001/Framework
-MyPrettyCMS/CurrentRelease-To-2-50-001/Layers
-MyPrettyCMS/CurrentRelease-To-2-50-001/Portals
-MyPrettyCMS/CurrentRelease-To-2-50-001/Solution
I archived the Initial version of the branch.
Now I can work on my next release and make some minor corrections to the current release.

Resources