Microsoft TFS 2010 - Branching and Merging - tfs

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.

Related

TFS - Make 2 Existing Folders related branches

I am working with TFS 2012 and wondering if I can accomplish something easily. I have two folders with several sub folders ... in a previous SC they were branches of each other.
Is there a way in TFS to make them have a "relationship"? I've used the "Convert to Branch" on both. When I try to "Merge", not surprisingly it has an "!" mark and says "A merge relationship does not exist between the source and the target. A baseless merge will be performed."
So is there any way to "create" that relationship? I realize I could delete one of the folders in TFS, create the branch, and then copy all the original files into the branch location and then check them in. But outside of that is there a way? I tried "Reparent" but the pick list is empty.
The trick is to go to the commandline where you can perform a baseless merge using:
Tf vc merge $/proj/branch1 $/proj/branch2 /baseless /recursive
After which you can use the reparent feature to setup the correct parent/child relation.
See also
https://alistairbmackay.wordpress.com/2014/01/15/tfs-reparenting-a-branch/

TFS 2012 Branch merge doesnt get everything

So Im trying to merge from branch A to B and after doing the merge, I check in the changes to B and then compare the branches again. There are still differences detected. One of which is a entity data model diagram "my_model.edmx.diagram".
Looking at the differences, its only seeing a difference in the location and width of the entity icons etc. This file is really just an xml file. There was also a .sql file also that didnt get merged and I managed to get it merged over by selecting it byitself, then merging just that file. The edmx.diagram file however, will not go over. Could it be an issue of file type?
Never heard this file type issue. If you can put the files into source control. Suppose these files must be supported by TFS.
A workaroud for this situation:
Clean the mapping folder for branch B(Make sure changes checked in)
and remove the mapping of branch B.
Remapping it to a clear local folder.
Merge branchA to B again, and check in the changes.
Update
Changes in each branch are independent from each other, so you don’t
have to check them in before switching from one branch to another.
Merging between sibling branches requires a baseless merging.
Source:https://msdn.microsoft.com/en-us/Library/vs/alm/code/overview (Capabilities→ Fundamentals → Branching )
I think you are using source control instead of Team Explorer. I had the same problem.
Asif

Ignore files on TFS merge

I recently moved from a svn shop to one that uses TFS. One of the issues I'm having in using the TFS merge is ignoring files. Our branches have several files that we never want to merge(version info, ivy files etc) and we have to manually uncheck them each time we run a merge. I know in SVN there is a file property you can set to ignore files during a merge, does TFS have anything similar?
Thanks in advance
From the command line, you can use something like the following:
tf.exe merge /discard <path to the file to exclude>
That will update the merge history as if the file had been already merged, so it won't continue appearing in the merge candidates list.

Merge multiple files in 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.

Why are all files marked with 'merge' in TFS?

I am merging my development branch into the main branch. There is only a subset of files that I have changed in my development branch, all other files should remain unchanged. Logically, I only want to merge files which I've changed. I would not check in a file which I did not change.
But when I do the merge operation in TFS, it marks every single file in the tree with change type 'merge'. It looks like I must checkin every single file in the whole source code tree! I really do not want to do this becasue then it becomes impossible to look at the changeset and see what files I acctually changed as part of my project.
At first, I thought I could use the tfpt.exe Undo Unchanged command to undo all the 'merge' changes, but this won't undo those changes.
Anyone have any ideas on this? thanks.
This also happens with a baseless merge. A baseless merge occurs when TFS doesn't have an existing merge relationship between the branches you're merging. As a result, it considers every file 'new' in both branches, so it 'merges' every file.
To create a merge relationship, so that future merges only list the files that you've actually changed, you need to do a baseless merge of all changes up to a specified version so that TFS knows what the common baseline should be. You should do this after merging these changes - it's too late to correct the baseline for this branch now.
If you don't actually want to take any changes from the other branch, but just tell TFS that these are logically at the same version, you can do a merge 'giving credit' for the changesets: tf merge /discard.
There are a number of possible reasons. This is not a complete list:
You performed a namespace operation (delete, undelete, rename) on a parent folder of the
files marked "merge"
You performed a namespace operation (delete, undelete, rename) that had already been performed in the target branch
You performed a sequence of namespace operations that collapsed into a no-op (eg delete + undelete, or rename a -> b -> a)
There are unresolved conflicts
You performing a discard
Note: all of these apply equally to 2005 & 2008.
In Visual Studio 2008 and TFS 2008, this does not occur. Only files that have changed will be marked as merge. If you do a compare of a file between the branch and the trunk are there any changes? Changes such as encoding will still make TFS merge this file back.

Resources