7

I'm sorry for my question but I'm TFS noob user, what is the equivalent in TFVC (Team Foundation Version Control) of git cherry-pick?

Tore Østergaard
  • 4,362
  • 3
  • 27
  • 43
slacky82
  • 342
  • 4
  • 11
  • https://stackoverflow.com/questions/3697530/in-tfs-how-can-i-cherry-pick-a-changeset-to-an-unrelated-branch – hjpotter92 Sep 22 '16 at 11:20

3 Answers3

14

There is one solution that has worked for me.

In TFVC, when you do a merge between 2 branches, there is a radio button where you can select to merge the whole branch or just a particular set of Changesets.

Follow the changeset option.enter image description here

lorengphd
  • 1,140
  • 8
  • 16
2

First, create a patch for the changeset that you want to cherry-pick:

tf diff /version:C1234 /format:unified > cherry.patch

(Note: be careful about redirecting to a file from PowerShell. It wants to write UTF-16 files which many programs have a hard time coping with.)

Then apply the patch using patch:

patch -p0 < cherry.patch
Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
  • Unfortunately this is not recognized. The correct way would be something like tf vc diff – radu florescu Nov 17 '16 at 11:34
  • What is `tf vc diff`? The documentation shows this as `tf diff`, which has not changed since TFS 2005. https://www.visualstudio.com/en-gb/docs/tfvc/difference-command (Please provide a link to some documentation if you're going to downvote and edit an answer with a command that doesn't appear to actually exist.) – Edward Thomson Nov 17 '16 at 12:18
  • since they added git functionality, the old way does not work. – radu florescu Nov 21 '16 at 08:21
  • 1
    I've found for a TFVC server that both "tf vc" and "tf" work the same way. Just guessing here, but perhaps if your server has both git and tfvc repos then you must specify, otherwise you don't need to. – TTT Jul 17 '17 at 22:14
-3

There isn't, really. TFVC and Git are fundamentally different source control paradigms, and you shouldn't try to use them in the same fashion.

In TFVC, cherry picking is considered a bad practice, as are baseless merges (TFVC has hierarchical branches -- a baseless merge is merging between two branches that don't have a parent/child relationship). A merge should typically consist of all of the changes made to the branch, sequentially, up until a given point in time. Although you can merge individual changesets and skip changes you don't want to include, you can't merge multiple non-sequential changesets in one operation.

Daniel Mann
  • 57,011
  • 13
  • 100
  • 120
  • 7
    "Although you can merge individual changesets and skip changes you don't want to include" - which is obviously what the OP is asking how to do. "You shouldn't do that" is not a valid answer to "How do I do _____?" – Phillip Copley Jun 05 '17 at 13:40