Switch node_modules folder when I change git branch : <p>I'm working with two branches, <code>master</code> and <code>feature-1</code></p>

<p>In the master branch I'm using a lib <code>xyz@1.0</code></p>

<p>In the branch  <code>feature-1</code> I've installed a new version from lib <code>xyz</code> version <code>2.0</code></p>

<p><code>feature-1</code> was not merged yet on <code>master</code> branch, because  it's not done. Then when I switch to <code>master</code> again I've to re-install the <code>lib@1.0</code>, and if I switch again to <code>feature-1</code> I've to re-install the <code>lib@2.0</code></p>

<p>What's the best workflow approach in theses cases?</p>
