title: How to ignore a file or directory in git, be it tracked, untracked or even part of commit
body: <p>I want to completely ignore a part of a git repository. The directory is currently tracked in the repository and I'd like to ensure that</p>
  
  <ul>
  <li>whenever anybody changes its contents in the upstream repository, I don't get any merge conflicts even if my copy is changed too.</li>
  <li>whenever I change its contents, any commits I make won't reflect these changes</li>
  </ul>
  
  <p>I don't care particularly about the actual contents.</p>
  
  <p>The problem arises with files automatically generated during build. Unfortunately, someone happened to commit them to the repository, but they cause build errors due to different paths etc. when used on different machine than their creator and consequently nasty merge conflicts.</p>
  
  <p>AFAIK, <code>.gitignore</code> won't work for this purpose, as it only applies to untracked files.</p>