Course lesson

Change the Commit Message of a Previous Commit with Interactive Rebase

We'll go back into our history with

Duration
3 min
Access
Free
Transcript
Retained from source evidence

We'll go back into our history with

git log --oneline

and then we can pick a previous commit and change its commit message with an interactive rebase. (Note: you shouldn't try to do this on commits that have already been pushed - only commits you still have locally)

To start the interactive rebase, we'll use:

git rebase -i HEAD~3

and then change pick to reword. Then we can reword the commit message and the commit will be rewritten for us.

Terminal
git log --oneline

# start the interactive rebase
git rebase -i HEAD~3
# and then change pick to reword.
# We can now reword the commit message

✏️ Edit on GitHub