2

I use the following command to merge a single changeset from Source to target branch:

result = BatchCommand(@"tf merge /version:" + chgnumber + "~" + chgnumber + @" """ + Source + @""" """ + Target + @""" /recursive /login:" + UID + "," + PWD + "", SourceTar[2]);

BatchCommand is another method which executes the command in cmd in my workspace SourceTar[2]. in some cases I get the error where I need to overwrite files. How can I do this automatically (Overwrite files).

Should I use /force for that? It definetly will resolve that overwrite conflict but will it also resolve other conflict(I don't want that).

I only want to overwrite files if that error occurs, other conflicts are resolved programmatically. Any suggestion would be helpful;

Shaun
  • 1,293
  • 16
  • 19
amit dayama
  • 3,246
  • 2
  • 17
  • 28

1 Answers1

3

You need to work with tf resolve command to resolve conflicts. Your commands can be the similar to:

tf merge $/TeamProjectRoot/Branches/Source $/TeamProjectRoot/Branches/Target
tf resolve $/TeamProjectRoot/Branches/Target /r /i /auto:TakeTheirs

/auto:TakeTheirs option accepts the changes from the source of the merge and overwrites the changes in the target.
/auto:KeepYours option discards the changes from the source of the merge and leaves the target unchanged.

Community
  • 1
  • 1
Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22