Search code examples
pycharm

How to edit a commit message in PyCharm?


In git there is a command git commit --amend to edit your last commit message. I was looking for this type of functionality in pycharm and can't seem to find it. I googled and couldn't find anything. Does this exist in pycharm?


Solution

  • I had the exact same issue and thought I should clarify and bring all the fore-mentioned knowledge that worked for me in one place:

    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.

    Following LazyOne's comment, at https://www.jetbrains.com/help/pycharm/2016.1/commit-changes-dialog.html it explains how the Amend commit" option works. Furthermore, as it was clearly noted by Liam Jones, you must not only tick the Amend commit" option but also select to commit some new change (any small change would suffice) in order for the Commit button at the bottom to become available.

    When you do the above steps, then this new commit along with the changes of the previous commit will be merged using the latest commit message; in other words, this way you replace the commit message of your last commit.

    Of course, the git commit --amend option (as described here https://git-scm.com/book/en/v2/Git-Basics-Undoing-Things) is perhaps another (cleaner) way for someone who can work outside of an IDE.