24

I'm using TFS with VS2008 and VS2010 and in the TFS collection I have several projects.

I've mapped the TFS root to a local drive to preserve the TFS folder structure and I've done a Get Latests of several subfolders.

I downloaded also an unwanted folder so I deleted the local folder contents but now in the TFS I see that folder in black and "Latest" Yes. How can I tell TFS that I've locally deleted a folder that I previously downloaded?

Martin Hollingsworth
  • 7,249
  • 7
  • 49
  • 51
Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
  • 1
    Apart from recreating your workspace, I don't think this is possible. – stuartd May 15 '13 at 12:39
  • 1
    @stuartd: amazing, seems something pretty common to undo an action like this one ... :? – Ignacio Soler Garcia May 15 '13 at 12:56
  • 1
    Right click on the folder you don't want locally and cloak it. Then TFS will ignore it. – MBulava May 16 '13 at 15:39
  • 1
    Of Course if you want to get the folder you locally deleted from TFS again, you can click get specific version, chose latest and then check "Overwrite all files even if the local version matches the specified version" I'm not sure what answer you're after hence the 2 different comments. – MBulava May 16 '13 at 16:01
  • @MBulava: What I'm after is to update the TFS server so it knows that I deleted some files from my workspace so it shows the right information on the source explorer. – Ignacio Soler Garcia May 17 '13 at 09:58
  • Of couse, you could also perform a "Get Specific Version" to revert to the previous TFS version of the file, but then any local changes that you had already applied to the file in the meantime will be lost. – Paul Jan 22 '14 at 10:25

3 Answers3

25

I think the problem is that you do not agree with TFS on what "latest" mean. "Latest" in TFS mean that nothing has changed on the server since you did get latest. It do not mean that what is on the hard drive is equal to the latest version on the server. So TFS shows what it is supposed to, see this question for more: Why doesn't TFS get latest get the latest?

The intended solution for folders on the server that you do not want to have on your local hard drive is "Cloak", as MBulava mentioned. (Right click folder -> Cloak). If you do not wish to have a folder on your hard drive I recommend this solution as it will never be downloaded until you uncloak it, and will show as greyed out and "not downloaded".

If you want to look at the differences between the contents on the hard drive and the server version you can use the "compare folders" feature. It will show that the folder is deleted on the hard drive.

If you want to get the folder mapped and grey (as the other folders you did not download) you can cloak it, and then uncloak it but answer "No" to downloading it now. This is equivalent to not downloading the folder in the first place.

Mixopteryx
  • 1,098
  • 1
  • 12
  • 18
  • 1
    This would be useful because if I downloaded something by mistake I don't want to see the code as current after I deleted it locally. I would like to know if what I have in the harddrive matches with what TFS has. I (who?) don't care about what happened since the last time I did a Get Latest. – Ignacio Soler Garcia Jul 31 '13 at 13:06
  • I made some edits based on your comments. Do any of the solutions work as you wish? – Mixopteryx Aug 01 '13 at 10:39
  • 2
    Aha, #4 that's what I was looking for. I want it to look like I never did a get on it. Thanx @Mixopteryx – Spike0xff Apr 10 '14 at 17:26
11

Martin Woodward has a cool TFS Top Tip #11 - Removing source control files from your local file system blog post that answers this problem without resorting to cloaking.

You need to Get Specific Version, change the Version Type to Changeset and specify 1 for Changeset number. His blog post goes into detail about why this works. I've verified this behavior in Team Explorer for Visual Studio 2013, 2015 and 2017.

Update:

If you have got a bunch of folders to process you can use the command line as follows replacing folderName with the relative folder as the Client itemspec or the equivalent Server itempec:

tf.exe get folderName /v:1 /recursive
Martin Hollingsworth
  • 7,249
  • 7
  • 49
  • 51
0

Mbulava's suggestion to use 'cloak' will leave the files and/or folders on the TFS server but will remove the files / folder from your local version and from the 'Get Latest Version' request.

If you have deleted files from your local directory and you then want those changes to appear on the server you need to go to the TFS director, select the files you want to delete, right click and delete the folders. Then you need to 'Check In' the pending deletion changes to the TFS server. TFS server will then delete the files / folders.

stevenbranigan82
  • 329
  • 1
  • 4
  • 13