title: Does npm publish command commit changes?
body: <p>I can see at <a href="https://docs.npmjs.com/getting-started/publishing-npm-packages" rel="nofollow">https://docs.npmjs.com/getting-started/publishing-npm-packages</a>, that <code>npm version &lt;update_type&gt;</code> changes the version number in <code>package.json</code> (also add a tag with this release number to your git repository if you have one). Then, with <code>npm publish</code> the change is commited and the package updated. </p>
  
  <p>I have a repository in Github which is published in <a href="https://www.npmjs.com/" rel="nofollow">NPM</a>.</p>
  
  <p>The question is: do I have to commit my changes 
  explicitly before <code>npm version &lt;update_type&gt;</code> or <code>npm publish</code>, or will <code>npm publish</code> take care of it.</p>
  
  <p>This is an example of how I proceed now:</p>
  
  <ul>
  <li><p>Make some changes</p></li>
  <li><p>Execute the next commands:</p></li>
  </ul>
  
  <p><code>git add .</code></p>
  
  <p><code>git commit -m "Message"</code></p>
  
  <p><code>npm version minor</code></p>
  
  <p><code>npm publish</code></p>
  
  <p>This is what I'm not sure if will work:</p>
  
  <ul>
  <li><p>Make some changes</p></li>
  <li><p>Execute the next commands:</p></li>
  </ul>
  
  <p><code>npm version minor</code></p>
  
  <p><code>npm publish</code></p>
  
  <p><strong>Edit:</strong></p>
  
  <p>In fact, if I execute <code>npm version minor</code> without committing the changes before, I get this error:</p>
  
  <blockquote>
    <p>npm ERR! Git working directory not clean.</p>
  </blockquote>
  
  <p>So the answer would be: <em>Yes, I have to commit my changes explicitly before <code>npm version &lt;update_type&gt;</code>.</em></p>