PyCharm/IntelliJ edit only a commit message

If you need to change/amend your commit message in PyCharm/IntelliJ before pushing it then you have several options:

My preferred way of changing commit message is the soft reset of the current branch. Depending on the situation I can use other way.

Amend commit

The officially recommended way of amending commit messages in PyCharm/IntelliJ.

  • Main menu
  • VCS
  • Commit - CTRL + K
  • Check Amend Commit
  • Amend the Commit Message
  • Do new change for commit
  • Add new commit message
  • Commit

From Jetbrains:

From VCS select Commit Changes, then tick Amend commit", select a new change to be committed and add new commit message (to replace the one of the previous commit). Finally, select Commit.

Selection_022

Undo commit

This one can be used if you want to change not only the message but also the files and the code:

  • Open Version Control Tab - ALT + 9
  • Open Tab Log
  • Right click the current commit
  • Undo Commit
  • Change the commit message

Reword

Most probably this is the closest one to simple changing the last commit message:

  • Open Version Control Tab - ALT + 9
  • Open Tab Log
  • Right click the current commit
  • Reword ..
  • Change the commit message

Reset Current Branch

This is like soft undo commit where the files are staged for commit again. Then you can simply commit with new message

  • Open Version Control Tab - ALT + 9
  • Open Tab Log
  • Right click the previous commit
  • Reset Current Branch to Here...
  • Select Soft - Files won't change, differences will be staged for commit
  • Commit the files
  • Change the message

Selection_025

Git command

If you prefer to use the command line you can always do. Open tab terminal and run ALT + F12:

git commit --amend

Related Article