title: git: ignore a file on pull from remote1, but push local version to remote2
body: <p>I have 3 git repositories:</p>
  
  <ul>
  <li><code>local</code>: my development repo on my local machine;</li>
  <li><code>remote1</code> used for collaboration with other developers;</li>
  <li><p><code>remote2</code> which is a Production server.</p>
  
  <ol>
  <li><p>I would like to <code>pull</code> regularly from <code>remote1</code> to my <code>local</code> repo and keep some local tracked files intact (i.e. fetch and merge from <code>remote1</code>, but exclude some local tracked files from being merged).</p></li>
  <li><p>On the other side, I would like to regularly <code>push</code> to <code>remote2</code> and I would like local tracked files to be pushed as well.</p></li>
  </ol></li>
  </ul>
  
  <p>In other words, I would like to have the following versions of <code>file1</code>:</p>
  
  <ul>
  <li><code>local</code>: file1 <em>v.1</em></li>
  <li><code>remote1</code>: file1, <em>v.2</em></li>
  <li><code>remote2</code>: file1, <em>v.1</em></li>
  </ul>
  
  <p>Note: <code>file1</code> can be anything (.css, .html, even .png)</p>
  
  <p>I have tried the following approaches:</p>
  
  <ul>
  <li><code>.gitignore</code> a file (does not work, the file becomes being tracked again after pull from <code>remote1</code>)</li>
  <li><code>git pull --no-ff --no-commit remote1 master</code>, then <code>git checkout --ours file1</code> according to <a href="https://stackoverflow.com/questions/2073841/how-can-i-discard-remote-changes-and-mark-a-file-as-resolved">this</a> (does not work, file1 becomes v.2)</li>
  <li><code>.git/info/exclude</code> as described <a href="https://stackoverflow.com/questions/1753070/git-ignore-files-only-locally/1753078#1753078">here</a> (does not work, nothing is ignored and even if it is ignored, <code>file1</code> will not be pushed to <code>remote2</code> then) </li>
  </ul>