title: Git - Ignore files during merge
body: <p>I have a repo called <code>myrepo</code> on the remote <code>beanstalk</code> server.</p>
  <p>I cloned it to my local machine. Created two additional branches: <code>staging</code> and <code>dev</code>.
  Pushed these branches to remote as well.</p>
  <p>Now:</p>
  <pre><code> local                   remote                   server
   --------------------------------------------------------  
   master  ==&gt; Pushes to  `master`  ==&gt; deployed to `prod`
   staging ==&gt; Pushes to  `staging` ==&gt; deployed to `staging`
   dev     ==&gt; Pushes to  `dev`     ==&gt; deployed to `dev`
  </code></pre>
  <p>I have a file called <code>config.xml</code> which is different on each branch.</p>
  <p>I want to ignore this file only during merges. But I want this to be included when I checkout or commit from/to the repo branch.</p>
  <p>The reason I want this is, we have a deploy script that pulls (checkout) the specific branch and deploys on the respective servers. So we need <code>config.xml</code> file of that specific branch go into the specific server as indicated above when deployed.</p>
  <p>I guess <code>.gitignore</code> wont work. What are the other options? Note that the ignored file should be part of checkout and commit, which is important. it should be ignored only during merges.</p>
  <p>Thanks!</p>