We currently have the following structure in one of our projects.
Trunk (Version 1)
Version 2
Version 3
Version 1 has become legacy
Version 2 is something which never got released and isn't needed anymore. But Version 3 is a branch from it.
Version 3 is the future and should be the new trunk.
So what I want to do is the following:
Make Version 3 the new trunk but without loosing anything from the current trunk.
So I stumbled upon "Reparenting with no parent" and from what I read it seems to do what I need, but I couldn't find anything about what would happen to the current trunk. Will there be two trunks?
Or would it be better to create a new tfs project from Version 3?
Thanks
Reparenting is when you want to move a branches parent from an old branch to a new branch for example. You want to create a new trunk to branch off of.
In general I would suggest to add a label of "Version 1" to the current trunk as a way to go back to the current version in the future if necessary. This is how you will "keep" the current trunk. Then you will probably need a baseless merge from version 3 to trunk. Then trunk is the latest and you can start branching new versions again.
Here is a good post with more details.
Related
I'm looking for the correct branching and merging strategy for the situation I'm currently in. A few weeks ago I created a new Dev branch from Main for version 1.6 of an application. This version is now being tested and will go live in the coming weeks.
Starting today I need to begin development for version 1.7, but I'm unsure how to proceed in TFS. I think there are 2 scenario's:
1. The dev branch for 1.7 is created from Main (as usual), and I integrate all 1.6 changes into the 1.7 branch and start my development. Any changes in the 1.6 will be merged into the 1.7 branch as soon as they are ready to be tested.
2. The dev branch for 1.7 is created by branching the 1.6 dev branch, any future changes in 1.6 will again be merged as per point 1.
The problem with #1 is the fact there is no direct relation between 1.6 and 1.7 according to TFS, which results in baseless merges.
The problem with #2 is the fact there is no direct relation between 1.7 and Main, which results in a baseless merge later on, when 1.7 is completed and merged with Main.
Is this a situation where baseless merges can't be avoided, or is my entire strategy wrong?
I'm assuming Main represents your last stable release and may be open to receiving hotfixes and the like to resolve critical issues. I'm also assuming that the typical workflow is that you begin developing a "vNext" version -- in this case, 1.6, and then work on that branch until you've completed work on it, then merge it into Main. The problem is that you're using ever-shifting development branches for your next release. You don't want to branch off of 1.6 to 1.7, because then you'd have to merge from 1.7 to 1.6 eventually, and then that 1.6 branch no longer accurately reflects what version 1.6 was.
I'd simplify things a bit. Create two "permanent" branches:
Main - your current stable "production" version
Dev - your in-development version (1.6, in this case)
Developers can work against Dev normally. When it's "done-done" and becomes the current stable version, it's merged to Main.
Now you have the ability to make feature branches (for longer-running, isolated features that aren't necessarily going out in the next release) or "vNext" branches (for stuff slated for the next release that you've discovered you have capacity to start working on earlier than anticipated).
Now you can create a branch off of Dev for your 1.7 work, and reverse-integrate your 1.6 changes into 1.7. When 1.7 becomes the new development target, merge 1.7 into Dev, and delete the 1.7 branch.
If you want to maintain older versions, you can use labels on the Main branch to represent each stable version, or you can create release branches to represent them.
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.
We have recently run across some merging issues, in which a single file came up with a bunch of conflicts, and it was just severely messed up. Our solution was to just take the source copy (we were Reverse Integrating) because there was no way to reconcile all the differences. Then, upon check-in, that file was not checked in because the source version already matched the latest version in the target branch.
My initial thought was that since the person doing the merge had not done a get-latest first, it was comparing Workspace Version instead of Latest Version. Is that a possibility? And if so, is there a way to force TFS to always compare Latest Version when doing a merge?
There is no way to force TFS always compare Latest Version when doing a merge. Since TFS merge the brach with the version what you choice.
But there is workaround to solve it.
For example:
You get the branch (changeset 98)to your local workspace to do same change.But the latest version in TFS server is changeset 100. After you finish your work, checking in the branch (get a changeset 101) , you could merge the branch(the latest version changeset 101) to your target branch.
Now the target branch including your changes in changeset 98 but not including the difference which between changest 100 and changest98. You need to merge branch again(choose changest 100) to the target branch. There maybe some conflicts, you can only manually solve it.
Finally,you have merged the latest branch including all changes to target brach.
To merge the latest version, you need to select Latest Version as Version Type.
I am having some legacy issues where development was done in the branch in the past. I would like to create a trunk from that branch. Is it even possible to do that in TFS?
Thanks
It's a bit heavy handed, but I just did a quick test and it works as you would expect. Delete the original trunk, then create a new branch from the active branch and name it "trunk".
You do need to check-in the deletion of the original trunk before attempting to create the new trunk branch
Alternatively, you could rename the active branch "trunk" after deleting the original, and then create a new branch from there to match your preferred structure.
Another alternative, if you truly want to permanently remove the original trunk and all of its history is to use tf destroy to remove it. Then create a new trunk from the current branch. Thanks #JamesReed for the reminder about the destroy command.
What's the difference between trunk and branch in jenkins?
It sounds like you're just interested in the terms trunk and branch in general in relation to source control. Trunk generally refers to the "main" version of source for a piece of software, and a branch is a (usually temporary) diversion from this main line, usually to work on a feature which is then merged back in to the trunk.
The details depend on which version control system you are using, but here's a description in relation to SVN:
https://stackoverflow.com/a/16163/206297
Trunk would be the main body of development, originating from the start of the project until the present.
Branch will be a copy of code derived from a certain point in the trunk that is used for applying major changes to the code while preserving the integrity of the code in the trunk. If the major changes work according to plan, they are usually merged back into the trunk.
As it relates to Jenkins, you're probably interested in which version of the software the continuous integration process should be building. I'd suggest more often than not it will be the trunk, as this is the canonical version, and the one most likely to be the candidate for release. But you might have branches for legacy version, etc, which might need building too. But it will depend of course on the process for any given company/project.