How to diff a file that’s not in your workspace?

The documentation for “tf diff” indicates that it should be possible to do things like
tf diff / c:\file.txt $/project/file.txt

Unfortunately, this syntax is not supported.  (Neither is the /workspace parameter, in case you were wondering.)  It’s an oversight I hope will be corrected in the future.  Until then, here’s a quick fix:

tf view $/project/file.txt > temp.txt
tf diff c:\file.txt temp.txt
del temp.txt

This technique should be easy to put into your scripting language of choice.

Leave a Reply