Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I edit previous git commit messages using Intellij? [duplicate]

I want to edit previous commit messages, not just the last one. Can I do this using the rebase dialog in Intellij?

like image 741
eggbert Avatar asked Oct 29 '14 17:10

eggbert


People also ask

How do you edit old commit messages?

If the commit only exists in your local repository and has not been pushed to GitHub.com, you can amend the commit message with the git commit --amend command. On the command line, navigate to the repository that contains the commit you want to amend. Type git commit --amend and press Enter.

How do I reuse last commit message?

When you add a new git commit in VS Code you can press Arrow Up in the commit message input to get the previous commit message. Press it several times to get older commit messages. Note: this only works for changes committed with the source control panel in VS Code.


1 Answers

I worked out how to do it but it seems long winded. Choose interactive rebase onto master, then 'edit' on the commit whose message you want to edit.

This is where you should be able to amend a commit in the commit dialog, but you can't because there's nothing to commit. So you have to go to the command line and do git commit --amend, then git rebase --continue.

Update: You can use 'reword' instead, see comments below.

like image 133
eggbert Avatar answered Oct 14 '22 04:10

eggbert