Can one amend a git commit message using IntelliJ<\/code> , or should one resort to command line?
Amend is supported: invoke "Commit Changes" and select the checkbox "Amend commit" in the Commit Dialog. Then press "Commit" button, and the commit will be amended to the previous one.
However, the support is limited:
Finally found a workaround for this.. This issue was troubling me for days.
It will show you your previous commit message, now you can amend the comments and say commit and push
Note: This solution uses android studio as intellij platform.
您还可以使用终端和shell(如powershell,cmd或bash(取决于您的系统))转到您的git文件夹,然后键入:
git commit --amend -m "your new commit message"
Commit messages can be edited during a rebase. Invoke the Rebase
command from the VCS
menu, confirm the branch settings, then click the Rebase button. You'll be presented with a list of your unpushed commits. Choose the reword
action from the drop-down to the left of the message you want to edit.
Check the git doc on Rewriting History for details on other rebase actions.
In the Log tab, select the commit and press F2 (Reword). Thats it.
To be fair, the quickest way to do this is via the command line. I know the OP was asking about doing it via IntelliJ (Its how I found this question, I was trying to do it in PHPStorm), but seriously, its so much easier via the command line.
When in the correct folder in your terminal / command prompt type
git commit --amend
You'll then be shown the last commit message, simply edit the text and save the file, job done!
If you want to change the editor (it defaults to vi), then use this command, changing "vim" to your editor of choice.
git config --global core.editor "vim"
ie windows users may want to...
git config --global core.editor "notepad"
Source: https://help.github.com/articles/changing-a-commit-message/
In case, 2018.3 and same with 2017.1
Alt + 9 (version control window)
And right click -> context menu click "Reword... F2 "
OR
shorcut F2 You can edit message.
In JetBrains Go to View -> Version Control
-> This would open the version control log tab to the bottom of the screen Go to Log
and you can see the commit that you did last Right click on it, and select undo commit
Bingo! You have reverted all your commit and the message is erased. You can also choose to do soft reset in case you only want to change the commit mesage
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.