Skip to content
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

Undo accidental commit messages. #232

Open
ChocolateLoverRaj opened this issue May 1, 2021 · 4 comments
Open

Undo accidental commit messages. #232

ChocolateLoverRaj opened this issue May 1, 2021 · 4 comments

Comments

@ChocolateLoverRaj
Copy link

So if someone does a feat commit and then a BREAKING CHANGE commit, then there will be a major version.

However, what if someone makes a commit that says BREAKING CHANGE, but then realizes that it's actually not a breaking change. How can they nullify the accidental commit message and make it a minor change instead?

@travi
Copy link
Member

travi commented May 1, 2021

if the commit is still in a branch that is not a release branch (latest or pre-release, etc), you would need to amend the commit message so that the breaking change is no longer in the history that ends up getting analyzed once the contribution is merged to a release branch. if it has already been merged to a release branch, it is too late to make an adjustment for since semantic-release will create a release as soon as it runs for that branch.

@ChocolateLoverRaj
Copy link
Author

I checked https://docs.github.com/en/github/committing-changes-to-your-project/changing-a-commit-message, and I agree that it's easy amending the last commit message. However, the article says that for older commits a force push is needed.

We strongly discourage force pushing, since this changes the history of your repository. If you force push, people who have already cloned your repository will have to manually fix their local history. For more information, see "Recovering from upstream rebase" in the Git manual.

Do you still suggest to force pushing new commit messages?

@travi
Copy link
Member

travi commented May 2, 2021

you should avoid rewriting the history of any of the release branches. however, branches that are not release branches should be safe to amend. in fact, it is recommended to rewrite the history of complicated branches significantly before merging to a release branch in order to tell an appropriate story in the generated release notes

@ChocolateLoverRaj
Copy link
Author

in fact, it is recommended to rewrite the history of complicated branches significantly before merging to a release branch in order to tell an appropriate story in the generated release notes

@travi is it in the docs somewhere? If not, can we add something in the docs saying that commits messages should be amended to 'cancel' a release type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants