-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to ignore reverted commits #382
Comments
Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️ |
I ended up with a similar situation before, made ever worse by the fact that it was a breaking change. The generated release notes not only had a giant |
I think supporting About detecting revert commits (i.e. cancelling out commits), there are some pending questions:
|
No, yes, maybe so. As far as I know off the top of my head revert commits to not have any special meta data that can reliably be used other than parsing the commit message. It is not even guaranteed that they follow the commit message pattern, although being built into Git as a default message means a large portion of them will follow it. Only some weirdos like yours truly sometimes edit the messages with more info.
The pattern you probably want to search for is not even the first line of the subject "Revert" but the "reverts commit " bit from the full body. |
Yeah I think that should be easily parseable. Another question is how would config look like if we decide to skip revert commits and remove reverted commits from the changelog? Something like the following maybe? [git]
include_revert_commits = false Or even better, we can combine this with #85: [git]
# commit types to skip as default, possible values are "merge" and "revert"
skip_commits = ["merge", "revert"] Also, does enabling this automatically cancel-out the reverted commits? I guess yes. |
Thanks for implementing the issue to ignore commits by adding the SHA to Maybe a revert of a commit can be detected if a commit follows in the history that:
If this is not enough security, one can match the commit message with a regex defined in the parser to get the SHA as the group SHA. { message = "^[Rr]evert", revert = true, pattern="This reverts\\s+(commit)?\\s+(?<SHA>[a-fA-f0-9]+)"} The text is somewhat defined here, so the pattern could be defaulted to the above without explicitly defining it. |
I just reverted a (conventional) commit. The problem is, that in the release notes this feature is still included. I have not found a way to exclude (ignore) a commit.
Would it be a good idea to add parsers that ignore previously added commits? For example, I have the following history.
- ...
If git cliff supported revert parsers, I could do something like this
Another option would be to add the git SHA explicitly
Or is there another option that I did not find in the documentation?
The text was updated successfully, but these errors were encountered: