TF: Checkin only selected files instead of all Pending changes while merging

checkin, tf-cli, tfs

Solution

I'm not sure I understand your problem right, but it is indeed possible to checkin only files in a specific folder. To avoid checkin problems you should probably do a "resolve" first. For instance

tf.exe get /r c:\src\branch1\project1 c:\src\branch2\project1

tf.exe merge c:\src\branch1\project1 c:\src\branch2\project1 /r /noprompt

tf.exe resolve c:\src\branch2\project1 /r /auto:acceptTheirs /noprompt
tf.exe checkin c:\src\branch2\project1 /r /noprompt /override:"done by script"

You should always do a `/noprompt` when running tf.exe from a script/automation process. This is to avoid popups. In the resolve I put `/auto:acceptTheirs` which will take the changes from the source branch when a conflicting change occurs. There are several different options here, you will have to concider which suits your purpose. /override on the checkin will override any checkin policies, which is probably (but not necessarily) a good idea from a script.

The approach with creating new workspaces every time is something I would try to avoid if possible. Creating and deleting a workspace is a heavy process, and in my experience it is difficult to keep track of all the workspaces so I usually end up with lots and lots of unused workspaces that needs to be removed.

Problem

Using tf.exe, the command line utility for TFS, I've automated the process of merging two branches using tf.exe in a batch file in simple steps: - TF Get... /Recursive - TF Merge... /Recursive However, while checking in the changes, "TF Checkin" Dialog shows all the pending changes selected in the dialog whether using /Recursive or not. What I want: To select only modified files in my selected folder instead of all the pending changes. Please note that this is a random thing, as I have 100's of files in my folders, so only files changed during Merge should be selected (definitely these would be modified ones). Solution I expect: To create a separate Workspace for my automated merge process. This would isolate the checkin process and would select only the changes made through this Workspace. Another Possibility: Is it possible to Checkin files in a specific folder and ignore rest of the pending changes? Thankx

Original source