How do I use an optional extension in a .gitignore file?
<p>I have the following two files</p>

<pre><code>./file
./file.text
./file.yo
</code></pre>

<p>Now I want to exclude all of these from git and I am not sure how. Thinking like regex I would do this <code>**/file(?:\..*)</code>, but I cannot translate this to the gitignore. I see there is an optional char which based on documentation appears to be <code>!</code>. But the documentation does not provide examples and I am not sure this is correct. </p>

<p>How would I write a <code>.gitignore</code> line for excluding all these files at once?</p>