14

Is it possible using .tfignore to add a wildcard to directories? I assumed it would have been a case of just adding an asterisk wildcard to the directory segment. For example:

\path\*\local.properties

However this does not work and I am unsure how I would achieve such behaviour without explicitly declaring every reference that I need excluding. .

Documentation

# begins a comment line

The * and ? wildcards are supported.

A filespec is recursive unless prefixed by the \ character.

! negates a filespec (files that match the pattern are not ignored)

Extract from the documentation.

Malachi
  • 33,142
  • 18
  • 63
  • 96

3 Answers3

16

The documentation should more correctly read:

The * and ? wildcards are supported in the leaf name only.

That is, you can use something like these to select multiple files or multiple subdirectories, respectively, in a common parent:

/path/to/my/file/foo*.txt
/path/to/my/directories/temp*

What may work in your case--to ignore the same file in multiple directories--is just this:

foo*.txt

That is, specify a path-less name or glob pattern to ignore matching files throughout your tree. Unfortunately you have only those two options, local or global; you cannot use a relative path like this--it will not match any files!

my/file/foo*.txt

The global option is a practical one because .tfignore only affects unversioned files. Once you add a file to source control, changes to that file will be properly recognized. Furthermore, if you need to add an instance of an ignored name to source control, you can always go into TFS source control explorer and manually add it.

Michael Sorens
  • 35,361
  • 26
  • 116
  • 172
  • 1
    Cheers for such a descriptive reply. I was hoping it would be possible but instead I explicitly declared each reference to the file. – Malachi Feb 09 '14 at 18:53
  • 11
    You can also put .tfignore files in subfolders and do the filename match from there. – Johan Gorter Sep 15 '15 at 15:03
0

It seems this is now supportedenter image description here

As you see I edited tfignore in the root folder of the project such that any new branch will ignore its .vs folder when being examined for source control changes

\*\.vs
Michael Bahig
  • 748
  • 8
  • 17
  • Instead of committing Excel files or Word documents to source control, have you considered using the markdown format (.md files?) -- There are free extensions for Visual Studio that support viewing & editing them, and they're viewable online in hosted TFS (or Azure Dev Ops, or whatever they rename it to next year). – BrainSlugs83 Sep 24 '18 at 19:41
  • 1
    Thanks I didn't think of that. I also thought of moving the releases sheet over to OneDrive. If Microsoft integrates between OneDrive and TFS that would be great too. – Michael Bahig Sep 28 '18 at 13:37
  • There might be some Teams integration, or now that I think about it... there may be an hosted TFS plug in that can do it... -- this one is specific to SharePoint -- but if I understand correctly, OneDrive for Business is pretty closely tied to SharePoint: https://marketplace.visualstudio.com/items?itemName=tuleva.build-release-sharepointtasks – BrainSlugs83 Sep 28 '18 at 21:40
0

Directory/folder name wildcarding works for me in VS2019 Professional. For example if I put this in .tfignore:

*uncheckedToTFS

The above will ignore any folder named ending with "uncheckedToTFS", regardless of where the folder is (it doesn't have to be top level folder, can be many levels deep).

bobt
  • 324
  • 3
  • 3