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
kain88-de edited this page May 4, 2024
·
37 revisions
Description
Sometimes, you may want to edit the message of a commit. Perhaps you're making "temporary" commits and cleaning them up later, or you're responding to feedback from a code review.
To update the content of a commit message, simply use the git reword command:
$ git reword my-branch
# or
$ git reword abc123
You can also pass -m/--message to specify the commit message inline:
$ git reword my-branch -m 'update some code'
Updating multiple commit messages
You can also update multiple commit messages at once. This can be useful if you are updating common information (such as a ticket number) or have a lot of temporary commits.
Pass multiple branches or commit IDs to git reword and it will open all of their commit messages in the same window:
$ git reword my-branch-1 my-branch-2 my-branch-3
You can also use revsets to specify commits in a more ergonomic way. For example, to specify all commits in the current commit stack, use the stack() revset function:
$ git reword 'stack()' # expands to all commits in the current commit stack