Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Just to add: `<first-commit-sha>^..<last-commit-sha>`` is inclusive range. Besides, excellent answer. It worked for me in Git Bash.
    – P D
    Commented Feb 18, 2022 at 11:34
  • 1
    this won't work most of the times: error: commit XXX is a merge but no -m option was given. fatal: revert failed. I'm starting to think the best general way to do this is git checkout <first commit> then git archive and then manually create a commit unzipping the archived version...
    – GACy20
    Commented Aug 22, 2022 at 13:36