# Reword : Change Commit Messages of existing Commits

## What's Reword in git

Reword is a handy feature of git rebase that can be used to change commit messages, mostly used by me to fix typos and improve message clarity such that clean and concise commit messages exist in the repository. There are other ways to change commit messages as well.

## When to use git reword?

Reword is particularly handy when you have to improve / change the commit messages of commits which have already been pushed to GitHub.

For changing last local commit message,

```bash
git commit --amend
```

can be handy to change the most recent commit message.

## How to change messages using reword with interactive rebase.

For using interactive rebasing to change the commit messages, we will need the commit id, or a simple method is to use

```bash
git rebase -i HEAD~n
```

n = Number of commits to display from the latest commit.

This will open a file in the code editor or terminal that looks somewhat like this.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691702486019/b6657407-59fe-4368-a3e2-50d9b3747026.png align="center")

In this file, replace, `pick` with `reword` for the commits where the message needs to be changed.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691702788457/e560ad41-9e0b-41eb-b7bd-580d434002ff.png align="center")

Save and close the file. This will open another file in which the commit message for the commit can be changed.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691702908890/ed538a75-0040-46ab-a6da-79297c345ae6.png align="center")

Just change the commit message in this file.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691702989073/ce969bcb-b917-4ea1-a710-f04ed229ed0b.png align="center")

After making the required changes to the commit message, save and close the file. A message like this should appear

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691703124375/c275dd93-5f81-432f-8f96-a275e3165c2f.png align="center")

Changed the commit message

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691704184552/3b8aef84-28f7-4c08-ac62-c628950df70c.png align="center")

Push the changes to the using `--force` .

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1691704572546/871d5a0d-d8f8-48ac-8eec-6f85177361de.png align="center")

## Final Conclusion

The reword feature within Git rebase emerges as a valuable asset for refining commit messages even after they have been pushed to GitHub. Developers can make sure that their commit history upholds a high standard of precision and clarity by utilising this tool.
