TFS branch and merging - tfs

I have a project folder called as "APP1" . We are currently deploying code from this folder . we would like to create one more folder or branch so that Dev can easily checkin all their new changes without directly affecting the main folder .
Should we have one more branch of folder "APP1" so that Dev can checkin all their changes in the newly created branch and eventually we can merge all the new changes to the main folder "APP1"?
Is this a correct approach and how easy it will be for us to merge all the new changes to the main folder ?
We have team of about 4 developers working on the same project .

You can consider using Basic Branch Plan. The structure like this Development <-- Main --> Release. You can branch your project "Main" into two, one named "Development", the other one named "Release". All users can work in Development branch, after they test their code, then merge to Main branch. When you want to release your project, you can merge your code from Main branch to Release branch.

That would be one way to do it. You'll likely need to play around with differing branching and merging strategies until you figure out what works for you and your team.
There's a large guide put together by the ALM rangers for TFS branching and merging strategies. See https://vsarbranchingguide.codeplex.com/
Here's a picture from one of their guides describing the potential branching/merging strategies that may work for your team, depending on team size and release cadence:

Related

Working with main and dev branches in TFS

I have to upload a new project to TFS. This project is already finished but it is not under control version yet.
I have decided to work with two branches: main, dev. In my case release is not necessary, I can do all the stuff using feature isolation branching strategy.
Initially I create a team project. Using team explorer from Visual Studio I create two folders: Main and Dev under team project.
First I upload project to Main folder.
From now on each time a new feature must be implemented I create a dev branch from Main folder and put it under dev folder, let's say dev_branch_01. This dev branch will be short-lived.
The implementation of this feature is divided into parts. Each part is done by a developer so each developer creates a new short-lived branch from the dev_branch_01 just created in order to implement the assigned part. When all developers have completed their part, they merge their dev branch into dev_branch_01 and resolve conflicts.
Once all the parts have been merged into dev_branch_01, QA Team makes the necessary tests against this branch. When all tests are passed by QA Team, dev_branch_01 is merged into Main branch.
Here, I have a doubt: all the short-lived dev branches done from dev_branch_01 by each developer could be deleted? Also dev_branch_01 could be deleted as well?
Later in future, when a new feature must be implemented, we repeat the process again, I mean, we create a new short-lived dev branch from main branch, let's say dev_branch_02 and we repeat the entire process explained above.
We always have one main branch and many short-lived dev branches.
I would like to know if the way we work with main and dev branches is correct.
Lest break this question:
Here, I have a doubt: all the short-lived dev branches done from dev_branch_01 by each developer could be deleted?
In TFS the branch are not physically deleted, when you first delete, TFS will just Hide from the main view, image bellow. because that you can't name a branch 2 times with the same name, to reuse a name you need to force delete which I don't recommend.
So, the answer for your first question the answer is yes, it can be delete without problem, just remember, you can't create a new branch with the same name in the future.
If you want to see deleted branches click in the button Xx in your Source Control Explorer. With this option, you'll see all the history of your old branches which is good because is the kind of think that you don't have with Git ease.
Also dev_branch_01 could be deleted as well?
I don't recommend that for 2 reasons
1 - I understand that you'll want to recreate this branch in the future and like i said, you can't create a branch 2 times with the same name.
2 - With this branch alive you will be able to restore a deleted branch for any reason that you'll find and keep the history consistence between branches.

ASP.NET MVC TFS Branching

I've read several posts about branch and merge feature of SVC and creating branches in TFS, following those steps I've created branch for a breaking change in a feature of ASP.NET MVC application,
After successful creation of branch, branched files (new files) excluded from application, attempting to include files in project will create duplicate signature errors.
so I've to carryout changes in original files (files available before branching) now I don't know actual purpose of branches.
If I need to work with existing files why do I need to create branch?
How to setup and configure branching operation in TFS Version Control?
How really it helps?
Edit:
Attached image
I've created a branch # controller folder (Source Control Explorer), After successful creation of Branch I found two directory in One Controller another Controller-Branch (which is excluded from project by default). Now in what set of files I need to work?
When I Work in "Controllers" file set, these changes push back to other developers and so I don't see any isolation of environment there.
If I need to work in "Controllers-branch" why it is excluded from project? when I attempt to Include "Controllers-branch" to project, code definitions, class names duplicated (i.e., these definitions conflicts with contents of "Controllers" folder)
Why there have two branches Controllers and Controllers-branch:
It’s because when you created a branch (branching and merging -> branch) based on Controllers folder, you also select Immediately convert source folder to branch (enables visualizations), this will convert Controllers folder to branch.
So based on your need, you should convert Controllers branch into folder (right click Controllers branch -> branching and merging -> convert to folder).
Why Controllers-branch is isolate from your project:
It’s because Controllers-branch is a branch, and the TFVC branch can achieve these goals:
• Manage concurrent work by multiple teams on the same codebase
• Isolate risks that are introduced by different sets of changes to
the codebase
• Take snapshots and then support subsequent isolated
changes (for example, to create a release branch)
So it should be works isolated. If your work own is not only updated files in Controllers folder, but also need to modify files for the whole project, you should create a branch from ApplicationMain folder a,d make sure Immediately convert source folder to branch (enables visualizations) is not selected. Then you can work on ApplicationMain-branch concurrently from other developers.

TFS Branching and Work Item Tracking

I want to create a new stream in TFS just like we use to do in clear case or clear quest tool by IBM. I believe we can achieve the same thing by creating a branch. I have been able to create branches but than when we create work items , we are not able to search work items for a particular branch . Work items are coming in root project only. Here is my structure
Root Project
- Main Branch
- New Branch
Am i doing it right way? Do i need to create a new project and branch there right under root level ? Like below
Root Project
- Main Branch
New Project
- New Branch
I hope i am able to clear what i want to achieve . Any TFS expert there?
TFS has work item tracking features designed to assist enterprise software development teams to manage their work and software defect tracking. Work Item is for a team project's team, not for a single project/branch (team project and project are not same thing). You can specify Area and Iteration for a work item.
Regarding TFS branch, you would never branch a team project, but branch a project. Check: Branch strategically. You can use branches to accomplish the following goals:
Manage concurrent work by multiple teams on the same codebase
Isolate risks that are introduced by different sets of changes to the
codebase
Take snapshots and then support subsequent isolated changes (for
example, to create a release branch)

In TFS, Cannot Reparent a folder that was converted to a branch

We have a TFS branch structure like Main > Integration > Several Branches under this.
The problem is that I created a folder 'feat-IIS6toIIS7Migration'outside the above hierarchy when I started coding. After finishing coding I converted the folder to a branch.
But the new branch has no parent and I want to put it under Integration. It seems that its impossible to do this in TFS, since when I try to re-parent I get an empty list of possible parents. Is there a way to put the new branch under Integration?
If you want the folder to appear under the integration branch then you can just move it (right click in Source Control explorer and select move).
$/Root/Integration
$/Root/feat-IIS6toIIS7Migration
becomes
$/Root/Integration/feat-IIS6toIIS7Migration
When the integration branch gets merged with either main or your development branches the folder will be added to those branches as part of the merge.
If you want to give the feat-IIS6toIIS7Migration folder a branching relationship with integration then you need to perform a baseless merge. Note you should only do this if the feat-IIS6toIIS7Migration folder is a full replication of the integration branch.
In TFS / VS 2012 you can perform a baseless merge from the GUI.
Right click on the integration branch in Source control explorer and
select merge. This will be your source branch.
In the target branch dropdown you won't be able to see the
feat-IIS6toIIS7Migration folder.
Select "Browse" and then navigate to the location of the
'feat-IIS6toIIS7Migration' folder.
Keep hitting next until VS performs the merge.
I would expect there to be a fair few merge conflicts and you'll need to resolve a lot of them manually.
In the future it would be better to create the branch for your development before you start work, then you can take regular merges so you don't have a big merge at the end of your development.

Rename a branch and then reuse the name for a new branch?

Currently we have a branch structure like this: Develop --> Release. I want to change it so that it looks like what the TFS Branching Guidance document calls "Basic Branch Plan". It looks like this Develop <-- Main --> Release.
I was going to do this:
Rename Develop to Main (creating Main --> Release)
Creating a branch from this Main reusing the "Develop" name (creating Develop <-- Main --> Release)
Will I have problems with TFS reusing an old branch name for a new branch? Know any gotchas or things to look out for?
Additional Info
I did this in a test instance creating test branches without any files, pending changes, history, etc. (not a good real test) and TFS let me do the rename and branch without difficulty. However, I won't feel comfortable with this unless I can take our production TFS project collection, restore it in the test instance, and test the rename/branch on real data. There is a lot of history and branches there and I don't know what will happen. As noted in the answer, there are other considerations before doing this.
I'm preparing to do similar steps (except I'm moving subfolder locations of both parent and a child while grandchildren stay put.)
QUESTIONS:
When are you planning the rename?
Are there any child branches under Develop branch that you didn't mention?
Do you have any shelvesets against Develop that might be impacted by the rename?
General answer: Proceed with caution. From my reading branch renaming in TFS2010 can cause a few unexpected side effects. TFS will be doing the following steps (under the hood) for your scenario:
Rename Develop to Main ==> Branch Main branch from Develop, then delete Develop branch
Create new "Develop" branch from Main
I recommend reading the following posts:
Renaming Branches in TFS 2010 (ChandruR’s Blog)
"MSDN Blogs > ChandruR's Blog > Renaming branches in TFS 2010
So my recommendations for this case:
Avoid renaming branches - a cleaner solution would be to, at the right point in your release merge all changes to a parent branch and then re-branch to create a new branch hierarchy.
Or for the brave of heart :)
You will need to time the rename of your branch, to a point in your release where you can merge to all related branches. The steps to follow are:
..."
Renaming branches in TFS2010 - But it works on my PC!
“In TFS 2010 behind the scenes a rename is actually a branch and delete process, this meant we ended up with the new branch, but also a deleted branch of the old name. This is not obvious unless you have ‘show deleted items in source control explorer’ enabled…”
"Now implemented as a branch + delete behind the scenes (new name is branched from the old, then the old name is deleted). This allows traceability in History, but allows us to get around the problems with merging renames (see Add, Rename, Add scenario). "
.
RANDOM THOUGHTS
Get all devs to merge (or abandon) all safe changes in child branches of Dev. Also prune any inactive branches before the rename.
Read above articles.
Search to find the page (that I haven't found yet) that describes exactly what will happen in simpler terms based on real experience.
Specifically I'd like to know what happens to shelvesets on the Develop branch after it is renamed to Main. (Next step can answer this.)
You might consider making a "Sandbox" Team Project (or Team Project Collection) then try out your scenario to see if there are major issues.
Pick right timing (see link#1) and go for it.
Check history, do a merge between the renamed branches, check history again.
Allow developers back in.
Good luck, and post back with any new information (including your end results)! -zs

Resources