Reputation: 3859
I have a DEV main line, a production branch and a UAT branch from it, all of which are in the same workspace. I added a new file to DEV and wanted to add it to UAT but not production.
Says to do it by merging at the directory level above the file, however what happens if I have several changes in that directory but only want to bring one file across?
I can do it by changeset, date etc but I would like to be able to do it on a file by file basis.
Is there a way to do this?
Upvotes: 0
Views: 1123
Reputation: 7551
In TFS, you can only merge according to branch relationships. Yours are Dev => Production => UAT
, so you can't merge Dev=>UAT without going through Production.
Options:
Not Recommended: Merge Dev=>Production, merge Production=>UAT, then rollback Production.
Why not: You'll have problems when you merge the entire Dev=>Production again.
Do a baseless merge of the file(s) Dev=>UAT. I think Visual Studio doesn't have that in Source Control Explorer, but you could do it in "Developer Command Prompt for VS2012", using tf merge /baseless
.
Just edit the file(s) in UAT and bring over its content from Dev.
In either 2 or 3, beware that once you've merged one branch to Production, you'll have a (possibly auto-resolvable) merge conflict when merging the other.
Upvotes: 0
Reputation: 795
One big point (for me) about TFS is that Changesets are atomic, i.e. when checking in changes to multiple files that all concern the same feature, errors during checkin lead to the whole operation to fail (as opposed to ClearCase, which will result in some files checked in and others not, making the version on the server incomplete). So if you take care to create changesets that contain exactly one feature, it is very easy to merge single features from branch to branch even if they concern hundreds of files, instead of having to figure out which files contain your changes and merging only those. In the real world, of course one feature will consist of multiple changesets with smaller changes, so you should create a Work Item for each feature to assign all changesets concerning that feature to. This way you can easily list all changesets that you need to merge. But I'm starting to ramble...
Anyway, as you rightly guessed, the way to go is merge the parent directory (or even the whole branch), but only the changeset containing the add. All other changesets will be ignored and can be merged the same way later on.
That said, I just looked at my Visual Studio 2010, and it does allow to merge single files just like you merge whole directories. Did you try that? I guess I just assumed you already did ;)
Upvotes: 1