You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using --amend and --message, the commit will be amended but the message will remain unchanged. The --message option is not respected and will be implicitly ignored.
Examples: lerna version minor --amend --message "My commit message"
lerna version publish minor --amend --message "My commit message"
Expected Behavior
The version/publish commands work as usual
The original commit is amended
The original commit is updated with the specified message from the flag: --message
The code below will accomplish everything above, but is not recommended due to pushing remote references twice:
#!/bin/bash# 1. Let lerna tag versions, publish npm packages with new versions, then amend commit (using original commit message)# 2. Push the commit to github. Creates new git tag as well# 3. Redo the commit message to use a chore commit using some magic# 4. Push the changes using the new commit message
lerna publish minor --amend --exact --yes
git push --follow-tags --force
version=$(node -p "require('./lerna.json').version")
description=$(cat ./.git/COMMIT_EDITMSG)
git commit --amend --message "[chore] publish packages $version" --message "$description"
git push --force
Steps to Reproduce
Change a source file in a repository and commit it with message "I changed a file"
Run lerna publish minor --amend --exact --message "This is a new commit message" --yes
Check repository
Git tags should be published correctly ✅
NPM packages should be published correctly ✅
Original commit amended with versioning changes/only 1 commit exists ✅
Commit message should be changed to "This is a new commit message" ❌
This issue may not be prioritized if details are not provided to help us reproduce the issue.
hammzj
changed the title
Using "--amend" and --message" options does not overwrite the original commit message
Using "--amend" and "--message" options does not overwrite the original commit message
Jan 11, 2024
hammzj
changed the title
Using "--amend" and "--message" options does not overwrite the original commit message
Using "--amend" and "--message" options will not overwrite the original commit message
Jan 11, 2024
Why do you have to push two times? I think one push in the end with the correct message will be sufficient. This push you have to do anyway as amend will not push.
First push is to use lerna to increment packages + publish them; it also amends a squashed commit so that all changes are kept in a single commit instead of two.
The second push is to change the original commit message to a custom chore message using the version change made in the first push.
We've tried it many other ways, and while it's not pretty, it functions how it is expected. lerna --amend should allow a custom message when specified to override the message of the commit it amends.
Current Behavior
When using
--amend
and--message
, the commit will be amended but the message will remain unchanged. The--message
option is not respected and will be implicitly ignored.Examples:
lerna version minor --amend --message "My commit message"
lerna version publish minor --amend --message "My commit message"
Expected Behavior
--message
The code below will accomplish everything above, but is not recommended due to pushing remote references twice:
Steps to Reproduce
lerna publish minor --amend --exact --message "This is a new commit message" --yes
This issue may not be prioritized if details are not provided to help us reproduce the issue.
Failure Logs / Configuration
lerna.json
Environment
npx lerna info
:The text was updated successfully, but these errors were encountered: