standard-version icon indicating copy to clipboard operation
standard-version copied to clipboard

How can I ignore the commit that has been reverted?

Open andykao1213 opened this issue 4 years ago • 3 comments
trafficstars

Let's say I have a feature commit:

feat: new feature

For some reason, we decided not to use this feature. So I revert it using get revert, which creates the following commit:

Revert "feat: new feature"

This commit revert...

Then I trigger standard-version, and the feature commits still exist. Is there any way I can ignore the commit?

Lastly, thanks for your hard work on this project. standard-version helps me greatly in my daily work.

andykao1213 avatar Sep 28 '21 03:09 andykao1213

Hey @andykao1213 – from the standard-version (conventional-changelog) perspective if the commit is in the history (and matches the commit preset you are using) it will still be written to the CHANGELOG.

That said, if you are using the --preset=conventionalcommits (the default in current versions) and use revert: you should see the output in your changelog:

commit a6f227df66ff7f8ee37afc863b975643043f30b7 (HEAD -> master, tag: v1.1.1)
Author: Joe Bottigliero
Date:   Sun Oct 17 15:43:22 2021 -0500

    chore(release): 1.1.1

commit 106c181ec9327042915f2e3f684a3a0e6a046218
Author: Joe Bottigliero <[email protected]>
Date:   Sun Oct 17 15:30:59 2021 -0500

    revert: Revert "feat: My New Feature"
    
    This reverts commit 38af4bcd9b10ab099527a1ce974191947d762fb3.

commit 534c65342c2618fb7724333cb8a373b73cc1156d (tag: v1.1.0)
Author: Joe Bottigliero
Date:   Sun Oct 17 15:30:28 2021 -0500

    chore(release): 1.1.0

commit 38af4bcd9b10ab099527a1ce974191947d762fb3
Author: Joe Bottigliero
Date:   Sun Oct 17 15:27:25 2021 -0500

    feat: My New Feature

commit 317b22f434619eeb8b0437024227152a109f4972
Author: Joe Bottigliero
Date:   Sun Oct 17 15:04:21 2021 -0500

    chore: init
# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.1.1](///compare/v1.1.0...v1.1.1) (2021-10-17)


### Reverts

* Revert "feat: My New Feature" 106c181

## 1.1.0 (2021-10-17)


### Features

* My New Feature 38af4bc

jbottigliero avatar Oct 17 '21 20:10 jbottigliero

Hi @jbottigliero! I get different results with yarn standard-version -s --preset=conventionalcommits and yarn standard-version -s as only the prior generates reverts into the changelog.

ChrisLahaye avatar Dec 04 '21 10:12 ChrisLahaye

What will happen if you have such a history, that the revert is in the same version?

revert: Revert "feat: My New Feature"
fix: handle some error
feat: My New Feature

When generating CHANGELOG, I suppose these two should be completely ignored:

revert: Revert "feat: My New Feature"
feat: My New Feature

unrevised6419 avatar Aug 26 '22 09:08 unrevised6419