<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">I run <code class="notranslate">npm version</code> and no commit or tag is created. I am not using <code class="notranslate">--no-git-tag-version</code>. F.e. just <code class="notranslate">npm version major -m "..."</code>.</p>
<p dir="auto">Under what conditions does <code class="notranslate">npm version</code> avoid creating a commit and tag?</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">Always commit and tag unless I specify not to.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/lume/lume.git
cd lume/packages/lume
npm version major -m &quot;v%s&quot; --ignore-scripts"><pre class="notranslate"><span class="pl-s1">git</span> <span class="pl-s1">clone</span> https:<span class="pl-c">//github.com/lume/lume.git</span>
<span class="pl-s1">cd</span> <span class="pl-s1">lume</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">lume</span>
<span class="pl-s1">npm</span> <span class="pl-s1">version</span> <span class="pl-s1">major</span> <span class="pl-c1">-</span><span class="pl-s1">m</span> <span class="pl-s">"v%s"</span> <span class="pl-c1">--</span><span class="pl-s1">ignore</span><span class="pl-c1">-</span><span class="pl-s1">scripts</span></pre></div>
<p dir="auto">After this, you will see that <code class="notranslate">package.json</code> was updated, but no commit or tag was created.</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>OS: Linux</li>
<li>Node: 14.16</li>
<li>npm: 7.10</li>
</ul>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto"><code class="notranslate">npm version &lt;version&gt;</code> is not committing the modified package.json or package-lock.json; nor git-tagging.</p>
<p dir="auto">We were using <code class="notranslate">npm version {major|minor|patch}</code> extensively (and successfully). It stopped working once the package was moved out of the root of the repo and into a subdirectory.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto"><code class="notranslate">npm version &lt;version&gt;</code> should continue to create a git-commit and git-tag as indicated in the <a href="https://docs.npmjs.com/cli-commands/version.html" rel="nofollow">docs</a>:</p>
<blockquote>
<p dir="auto">If run in a git repo, it will also create a version commit and tag. This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version. It will fail if the working directory is not clean, unless the -f or --force flag is set.</p>
</blockquote>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>initialize an npm package in the root of an initialized git repo</li>
<li><code class="notranslate">npm version minor</code> successfully bumps the version, commits and tags</li>
<li>move the npm package into a subdirectory of the repo</li>
<li><code class="notranslate">npm version minor</code> still bumps the version in package.json and package-lock.json, but git is not committed nor tagged.</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>macOS 10.15.7</li>
<li>node: v14.13.1</li>
<li>npm: 6.14.8</li>
<li>git: git version 2.28.0</li>
</ul>
<p dir="auto">This is apparently an existing bug going as far back as npm v3: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="264697877" data-permission-text="Title is private" data-url="https://github.com/npm/npm/issues/18795" data-hovercard-type="issue" data-hovercard-url="/npm/npm/issues/18795/hovercard" href="https://github.com/npm/npm/issues/18795">npm/npm#18795</a></p>