How do I remove Team Foundation files from git repo?

I have traditionally used Microsoft Team Foundation Server using Visual Studio, but am migrating to Git.

Team Foundation Server writes files to directories that begin with a dollar sign (e.g. $tf1)

I would like to exclude all files in those $tf directories from my Git repo. Sorry, I already committed them to the repo along with everything else in my project.

I tried the following to back them out:

steve@DESKTOP-Q3UVLK0 MINGW64 /c/home/fp (master)
$ git rm -r --cached $tf
fatal: No pathspec was given. Which files should I remove?

I know that the $ is a special character, so I tried all of the following:

  • $tf (fatal: pathspec ‘$tf’ did not match any files)
  • “$tf” (fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths)
  • ‘$tf’ (fatal: pathspec ‘$tf’ did not match any files)
  • $$tf (fatal: pathspec ‘46tf’ did not match any files)
  • ?tf (fatal: pathspec ‘$tf’ did not match any files)

None of these work.
How can I remove the folders that being with a dollar sign from my Git repository in which they are already committed?

Follow-up: How would I specify these in .gitignore?

Many thanks for guidance.

Arghh, never mind! It appears that $tf did indeed work, but it did so silently so the next time I issued the command, it didn’t match any files since they were already removed from the cache.

Oh, and this seems to work in .gitignore: