Creating a Patch with TFS

Version ControlTfsPatch

Version Control Problem Overview


Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible?

If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)?

Version Control Solutions


Solution 1 - Version Control

tf diff /shelveset:shelveset /format:unified

Edit: This writes to standard output. You can pipe the output to a file.

For more options, see Difference Command.

Solution 2 - Version Control

Because TFS doesn't natively support patch files, the most common thing I see people do on CodePlex is simply zip the modified files and upload the zip. The project coordinator then does a diff against their own checkout.

However since CodePlex also supports TortoiseSVN, more and more people are using that to create their patch files.

Solution 3 - Version Control

I wrote a blog post about a similar issue where I used the TF.exe command and 7Zip to create a TFS patch file that could then be applied on another TFS server or workspace. I posted the the Powershell scripts at Github, which can be used to Zip up any pending changes on one workspace and then apply them to a different server. It would have to be modified to use a changeset instead of pending changes, but that shouldn't be too difficult to accomplish.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionswilliamsView Question on Stackoverflow
Solution 1 - Version ControlCurt HagenlocherView Answer on Stackoverflow
Solution 2 - Version ControljwanagelView Answer on Stackoverflow
Solution 3 - Version ControlGreg BrayView Answer on Stackoverflow