So you have to use TFS at work. Well I do. This post is about all the tips and tricks I come across for working with TFS.

Getting your current changeset number

Sometimes you might want to know what changeset you are on, so that if you get the latest code you have some idea of where you where at before the update (in case you have to go back).

So open the Visual Studio Command line where all the paths are set up for you. Cd to the root of your local TFS workspace. Then use tf.exe:

tf history . /r /noprompt /stopafter:1 /version:W

It will output something along the lines of this (which conveniently displays the current Changeset):

Changeset User           Date       Comment
--------- -------------- ---------- ----------------------------------------
217040    Lars User      23.10.2013 fixed the bug with .. etc ..