title: Conditional .gitignore files - adding logic to .gitignore
body: <p>So I have TypeScript project. The generated .d.ts and .js files can cause unnecessary merge conflicts.</p>
  
  <p>However, this project is big and is currently only ~50% converted from JS to TS, so I cannot simply .gitignore all .js files. Furthermore, there are some .js files which I will never convert to .ts.</p>
  
  <p><strong>So is there a way to conditionally ignore a file?</strong></p>
  
  <p>The logic is of course simple:</p>
  
  <pre><code>ignore z.js if z.ts exists
  </code></pre>