2019-10-17

Introduction to .ignore files syntax and capabilities



------------------

You'll mostly have to look up the documentation of the .ignore files syntax if you want to master this tool and find the right tradeoff/middleground between being specific and being generic about what files you ignore in your project.

------------------

In general, you can either 1/ be specific or 2/ use wildcards or 3/ use negation patterns. For instance you could say ignore all "bin" directories, except a particular one:

```
/**/bin
!/Golum/MyPrecious/bin
```

Notice the exclamation mark at the begining of the second line: it's a negation. It means: DO NOT IGNORE.
=> Those two lines combined, will ignore all "bin" directories, wherever they are in the tree ( double asterix = means any subdirectory ) except that one particular one, named on the next line and prefixed with an exclamation mark.


------------------

But saying this I'm only scratching the surface of the power of the .ignore files, you need to look at the doc to know more. (eg. you can have a generic .ignore file at the root of the solution and, for specific cases, other .ignore file(s) in subdirector.y.ies somewhere too)

------------------

Last but not least, if you're confident with .ignore file, you can even invoke destructive commands such as "clean" and delete everything that is not under source control ( ie. that is ignored )... which is basically a prequel to REBUILD ALL.

```
# WARNING: cleans absolutely everything that is not under source control
    git clean -nfdx # << To preview what would be deleted... -n = NoAction = --dry-run
    git clean -fdx # << The actual cleanup.
```

----------------

"tfignore file - Google Search"
"https://www.google.com/search?q=tfignore+file"


For Fox

"Visual Studio 2015 TFS .tfignore file - Stack Overflow"
"https://stackoverflow.com/questions/36768954/visual-studio-2015-tfs-tfignore-file"


For Seb

Excluding Files From Team Foundation Version Control Using .tfignore Files - Applied Information Sciences
https://www.appliedis.com/excluding-files-from-team-foundation-version-control-using-tfignore-files/


For everybody

"GitHub - sirkirby/tfignore: A Collection of .tfignore Templates"
"https://github.com/sirkirby/tfignore"

"GitHub - github/gitignore: A collection of useful .gitignore templates"
"https://github.com/github/gitignore"



No comments:

Post a Comment