title: git: Keep one specific version of a file
body: <p>For a university project, we are using a git repository that was set up by the chair giving the lecture. Once a day their server pulls the latest version of our project and runs secret evaluation tests. Therefore we need to guarantee that the files in our repo can be compiled by the server.</p>
  
  <p>Since we used flex to generate code for one of the tasks we had to accomplish, we need to guarantee that the file was generated by the correct flex-version. (Otherwise, the server can't compile the generated file.)<br>
  But my system doesn't support the flex-version of their server. So I do need to generate another version of the file to compile everything on my system. When I'm finished with coding my usual routine at the moment is:</p>
  
  <pre><code>git add --all
  git reset generated-file1.c
  git reset generated-file2.c
  ... (commit and push)
  </code></pre>
  
  <p>Since this was getting on my nerves I've already created a custom command that does this for me. However, I wanted to ask if there is something similar to a <code>.gitignore</code> to "lock" a specific version (that will compile on the server) of our generated files. So anyone on our team will only need to use <code>git add -all</code> in order to add everything except the generated files.</p>
  
  <p><strong>Edit:</strong>
  Thanks to <a href="https://stackoverflow.com/users/7976758/phd">phd</a>'s suggestion <a href="https://stackoverflow.com/questions/32251037/ignore-changes-to-a-tracked-file">here</a> I came a little bit closer to what I want. What's still missing for me is the part:</p>
  
  <blockquote>
    <p>... <strong>anyone on our team</strong> will only need to to use <code>git add -all</code>...</p>
  </blockquote>
  
  <p>By using <code>git update-index --skip-worktree generated-file*.c</code> I will only fix this for my system. What I was looking for is a one time change in our repo that affects all systems. (The other members have the same problem as well.) </p>
  
  <p>I know that they could copy and paste the same thing into their terminal, but I wanted to know if there is a more elegant way to do this (similar to the <code>.gitignore</code>), where I can list the files and they will be ignored on every system.</p>
  
  <p>Cheers,<br>
  Pascal</p>