Apply diff from one branch as a patch to another in Visual Studio TFS

We have a project in which we work in the branch for version 6.1. One of the changes introduced in branch 6.1 (changeet 1800) was a fix, and someone decided it was urgent enough to deserve a patch for our version 6.0 release.

Now, changes have been made to the file in question before the 1800 change and after it. They want the JUST patch to be applied to 6.0.

According to http://linux.die.net/man/1/patch, it seems best to create a diff file by comparing change sets from 1800 to 1799, and then apply this diff file as a patch to 6.0. I don’t even know where to start doing this in TFS.

As a backup plan, I can always just figure out the differences in the 1800 changeset manually and copy them into the latest version of the product to fix it, but I would like to do it right if possible.

Except: I understand that using only diff, you risk that part of the code involved in the difference 1799> 1800 depends on the code that was installed only between the current production version and the 1799 changeset, but this can be easily checked quickly building and testing products after applying the diff patch. We are not worried about this.

+6
source share
1 answer

Well, I'm not sure I fully understood, but here it is:

Changes in TFS do not preserve the absolute contents of the file, but the difference (lines added, deleted, changed).

If you want to report a bug fix from version 6.1 to 6.0, and this fix is ​​included in the 1800 changeset (and no more than this fix), simply merge this changeset into version 6.0. All changes made before the change set 1800 will not be merged into 6.0, only what you have done in this change set will be merged.

When you merge, you have two options:

  • Merge all changes from the source branch to the destination
  • Merge the selected set of changes from source to destination.

Use the second one and specify change set 1800, and everything will be in order.

Some shots:

enter image description here

enter image description here

The ONLY selected change set will be merged.

+9
source

Source: https://habr.com/ru/post/916482/


All Articles