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;
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/Targettf resolve $/TeamProjectRoot/Branches/Target /r /i /auto:TakeTheirs/auto:TakeTheirsoption accepts the changes from the source of the merge and overwrites the changes in the target./auto:KeepYoursoption discards the changes from the source of the merge and leaves the target unchanged.