Merge multiple files in TFS - tfs

We're using TFS as version control system for our software. Currently the software has two versions in two separate branches: branch "Version 1.0" and branch "Version 2.0".
Every fix in "Version 1.0" has to be merged into "Version 2.0". I merge manually from the context menu on the file to be merged.
My problem is that some fixes comprise more than one file located in different folders. Then I have to perform the same action on every file.
Is there a posibility to merge a group of files at once? If not, is there a recomended practice how to perform the merge operation?

You have a couple options:
If you know the changesets you want to merge (or the changesets you want to avoid merging) you can choose a folder up the structure from the files you want to merge then do the merge by selecting the specific changesets you want. This is a little complicated if you have changesets 2000,2001,2004, 2010 and you want 2001 and 2010. You can only merge consecutive changesets in the list per merge so you would have to merge 2001 then 2010. This is still better than merging many files if you have more files then changeset groups.
If you want to merge everything under that folder up to a specific changeset or most recent changeset you can do that in one bulk merge.
In both of these you will still have to resolve issues where a different change was made to the same line in the same file in the source and target branches.

Related

Microsoft TFS 2010 - Branching and Merging

I need to branch and merge hundreds of files and the only way I know is to do it manually one by one.
Is there an automated way where I can just list all the file names with their path, add change set, and indicate the destination for it all to run by itself or better yet since the files have similar names (project id), an condition where it should go.
You can branch and merge at the folder level. You do not need to branch and merge individual files, you can branch and merge a folder that contains all of the required files.

HowTo: correctly synchronize TFS branches with missing changesets?

Background
If I merge our main branch to our development branch, TFS will state that there are no changes to commit. And yet, a file level comparison (using WinMerge) clearly shows that there are differences (e.g. files missing, files with different content, etc.).
In short, our main and development branches are no longer in sync which is most likely due to changesets that were lost during previous TFS migrations.
Question
What is the best way to produce the following?
Synchronizing the main and development branches by: performing all of the necessary insert/update/delete operations on the development branch. (i.e. main is the master copy).
At the end of the process WinMerge should indicate that there are zero (0) differences between the two branches.
Keeping the development branch history intact.
Notifying TFS that the development branch is now fully synchronized with main so that:
TFS won't try to merge older development changesets with main
only future changes to development will be pushed to main during a merge operation.
TFS is not my area of expertise - any guidance that you can provide would be greatly appreciated.
Context
Visual Studio 2015
TFS (version 14.95.25122)
References
Merge Command
"Performs a merge without a base version. That is, allows the user to merge files and folders that do not have a merge relationship. After a baseless merge, a merge relationship exists, and future merges do not have to be baseless."
Although Development was branched from Main, it looks like this might address my lack of history (i.e. missing changesets) problem.
TFS Merge: Best Practices
TFS: Overwrite a branch with another
tf merge A B -r -force -version:T
I don't think this will work for us because changesets are missing.
When TFS does a merge, it bases the merge on prior merge history, not on the actual contents of the source and target files.
This issue may by caused by picking keep target when perform merge or at one time, a merge with the discard option performed (using the command line TF merge /discard).
To solve this issue, you can try to:
Use the /force option with the tf merge command. If there is a changeset that was previously merged (perhaps incorrectly) and you want to merge it again. The /force flag ignores merge history that indicates a particular changeset was previously merged from source to target, and merges the changeset again.
Undo the previous merge using Rollback. If you've recently done the merge in which changesets have been discarded. Find it in the history, rightclick the changeset and pick Rollback and check in the code that has been undone.

TFS 2010: Remove changesets to be merged

In TFS 2010, when I want to merge files from one branch to another, I get a list of changesets that are yet to be merged to the target branch. The problem is a lot of these changesets have already been manually merged. So I am getting a lot of 'There were no changes to merge.' messages.
So I need to remove those changesets ( which have already been merged, i.e. no changes to merge) from the total list of changesets that are to be merged with the target branch. Please suggest a way to do this as I am new to TFS.
You should always be meeting the latest, or everything up to a specific changeset.
http://nakedalm.com/avoid-pick-n-mix-branching-anti-pattern/
Picking and choosing changesets to merge is not a good way to manage your code.
To unblock your merge you will need to discard the merger candidates that are no longer relevant.
tf merge /discard

Regenerate conflicts of completed TFS merges

I have recently discovered that I was using my third party diff/merge tool incorrectly when resolving conflicts encountered merging from the trunk to my team branch. As far as I know, only files that were merged in the merge tool were affected. I know how to use tf merge /force to re-do a merge, but I don't want to re-merge every file if I can avoid it, just the ones that I had to merge manually. Is there any way to get a list of such files now, long after the merge changesets have been checked in?
Unfortunately, TFS does not track any data about which files were resolved using a merge tool. Whether a file was merged manually or automatically it is still just recorded as a "merge" in TFS.

TFS baseless merge

I am merging two branches which do not have a parent child relationship. I have started with a single file to test if the merge is working properly before the actual merge. I am using tfs baseless merge in order to do this.The following is the command:
Tf merge /baseless C:\Inetpub\wwwroot\Test\CreateDescription.aspx.cs C:\Inetpub\wwwroot\Test1\CreateDescription.aspx.cs /recursive
Changes have been done in both the files. However in the resolve conflict dialog box I only see two options
1) Keep the changes in the target branch
2) copy code from source branch
Merge changes in merge tool is greyed out. What should I do in order to enable this option. I want to manually merge changes in the both the branches.
A simple way to do this would be to check out the file you want to be the target (i.e C:\Inetpub\wwwroot\Test1\CreateDescription.aspx.cs) and then use an external merge tool to merge the changes. I'm a big fan our SourceGear Diffmerge, mainly because it's free (as in beer). This will allow you to merge the files and resolve the conflics.
Once you've done this, you could run the baseless merge to establish the merge relationship between the branches and tell the merge tool in TFS to keep the changes in the target. You can also tell TFS to use DiffMerge as it's merge tool which might get rid of the problem all together.

Resources