Handling changes to files with --skip-worktree from another branch : <p>On my machine, I've set <code>--skip-worktree</code> to <code>config/database.yml</code>.</p>

<pre><code>git update-index --skip-worktree config/database.yml
</code></pre>

<p>Another developer has committed and merged into the develop branch changes to <code>config/database.yml</code> while working on the project.</p>

<p>Now, when I do <code>git pull origin develop</code>, I get</p>

<pre><code>Andrews-Air:[project] agrimm$ git pull origin develop
From bitbucket.org:[company]/[project]
 * branch            develop    -&gt; FETCH_HEAD
Updating [SHA]..[Another SHA]
error: Your local changes to the following files would be overwritten by merge:
    config/database.yml
Please, commit your changes or stash them before you can merge.
Aborting
</code></pre>

<p>How should I handle such a change? Should I do</p>

<pre><code>git update-index --no-skip-worktree config/database.yml
git stash save "Save changes to config/database.yml"
git pull origin develop
git stash apply
# Fix any conflicts
git update-index --skip-worktree config/database.yml
</code></pre>

<p>Or is there a less hacky approach?</p>
