microsoft / beachball

The Sunniest Semantic Version Bumper
https://microsoft.github.io/beachball
MIT License
742 stars 86 forks source link

Feature request: option to amend change files to commit #646

Open antonpug opened 2 years ago

antonpug commented 2 years ago

Add ability to choose between a separate "Change files" commit and having beachball git commit --amend

ecraig12345 commented 2 years ago

One workaround for this right now (besides reverting the commit) is that you can run beachball change --no-commit or add commit: false to your beachball config. That way it will generate and stage the change files but not commit them. Then you can amend them to the previous commit.

ecraig12345 commented 2 years ago

Thinking about it more, I'm not sure this is something that ought to be added as a repo config option, though it might be reasonable to support as a command line flag only.

The reason I don't think it should be a repo option is the potential for user confusion: if someone has committed and pushed changes, then runs beachball change with amend enabled in the config, updating the branch would require a force push. If the user doesn't already know about this behavior, their next push attempt would fail and they wouldn't understand why. Also, force pushing becomes problematic if multiple users are working on a branch, so introducing an option that's likely to sometimes require force pushing is not ideal.

Adding an --amend option which can only be specified as a command line flag would be less risky since it's opt-in for each user.

In the meantime, adding commit: false in the beachball config (and then the user can either commit or amend as desired) comes close to covering this scenario.