I pushed my git commit and realised the commit message is incorrect. How can I change the commit message from Intellij? I am the only one using the remote feature branch with this commit. What are the drawbacks of doing this?
Asked
Active
Viewed 1,257 times
0
-
3See https://stackoverflow.com/questions/8981194/changing-git-commit-message-after-push-given-that-no-one-pulled-from-remote. There's really no reason to not just do it in a command console. – isherwood Jan 06 '22 at 16:35
2 Answers
1
You can use Edit commit message
action in Git Log in IDE as mentioned here:
https://www.jetbrains.com/help/idea/edit-project-history.html#reword-commit
Then you can do a force push as mentioned here Ctrl/CMD+Shift+K
or Git | Push and then click on an arrow next to Push
button and click Force push

Ruslan Kuleshov
- 1,934
- 1
- 7
- 11
-
2Thanks a lot Ruslan. When I did Force Push I got a message: You are going to force push to
. It may overwrite commits at the remote. Are you sure you want to proceed? The result was exactly what I needed. The procedure you described changed the commit message in the local branch and at the remote branch. Since nobody pulled this branch (only I am working on this feature), I believe Force Push was safe. – Anuska Jan 07 '22 at 08:01
1
Let's suppose you did your first commit already and you want to change. Simply open the terminal inside Intellij.
First check your commit by typing:
git log --oneline
after, if you decide to change your commit, you simply type:
git commit --amend -m "new commit that overrides first commit"
you can again check your commit by typing git log --oneline
and if you are okay with everything, you can push it to the remote repo.

Utku Can
- 683
- 3
- 12