Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What version of Git are you using?</p> <p>Reverting multiple commits in only supported in Git1.7.2+: see "<a href="https://stackoverflow.com/questions/4716051/rollback-to-an-old-commit-using-revert-multiple-times">Rollback to an old commit using revert multiple times.</a>" for more details.<br> The current <a href="http://www.kernel.org/pub/software/scm/git/docs/git-revert.html" rel="noreferrer"><code>git revert</code> man page</a> is only for the <em>current</em> Git version (1.7.4+).</p> <hr> <p>As the <a href="https://stackoverflow.com/users/12149/alex-spurling">OP Alex Spurling</a> reports in the comments:</p> <p>Upgrading to 1.7.4 works fine.<br> To answer my own question, this is the syntax I was looking for: </p> <pre><code>git revert B^..D </code></pre> <p><code>B^</code> means "the first parent commit of B": that allows to include <code>B</code> in the revert.<br> See "<a href="https://git-scm.com/docs/git-rev-parse#_specifying_revisions" rel="noreferrer"><code>git rev-parse</code> SPECIFYING REVISIONS section</a>" which include the <a href="https://git-scm.com/docs/git-rev-parse#git-rev-parse-emltrevgtemegemHEADv1510em" rel="noreferrer"><code>&lt;rev&gt;^</code>, e.g. <code>HEAD^</code></a> syntax: see more at "<a href="https://stackoverflow.com/a/1956054/6309">What does the caret (<code>^</code>) character mean?</a>")</p> <p>Note that each reverted commit is committed separately.</p> <p><a href="https://stackoverflow.com/users/6962/henrik-n">Henrik N</a> clarifies in <a href="https://stackoverflow.com/questions/4991594/revert-a-range-of-commits-in-git/4992711#comment16848992_4992711">the comments</a>:</p> <pre><code>git revert OLDER_COMMIT^..NEWER_COMMIT </code></pre> <p>As shown below, you can revert without committing right away:</p> <pre><code>git revert -n OLDER_COMMIT^..NEWER_COMMIT git commit -m "revert OLDER_COMMIT to NEWER_COMMIT" </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload