Using Eclipse/EGit how do I edit a commit message of a commit I've made locally, but haven't pushed to the repository yet?
2 Answers
That would be the "Amending Commits" section of the EGit User Guide:
open the Staging View or Commit Dialog again and select the option Amend previous commit in the toolbar.
See also this tutorial:
Git amend allows to adjust the last commit.
For example you can change the commit message.
The Git Staging view allows you to perform the Git amend command via the highlighted button in the following screenshot.
See more about git commit --amend
in general at "The git commit --amend
Command".
99sono adds in the comments:
I use:
Team Synchronizing Prespective
>History View
>Modify
(submenu) >Reword
.
Finally this opens a popup where I can edit the old commit message.
See "Add ability to reword and squash commits directly from the history view"

- 1,262,500
- 529
- 4,410
- 5,250
-
1Thanks. Doesn't it end up as two different commits? – Grzegorz Oledzki Jan 31 '14 at 09:00
-
1@GrzegorzOledzki Yes and no: amending the previous commit will *replace* said previous commit by a new one. – VonC Jan 31 '14 at 09:01
-
1Because I can see two entries (commits) locally. Does it mean - these two commits (original one and the one amending) will end up being a single one when I push it to central repository? – Grzegorz Oledzki Jan 31 '14 at 09:06
-
1@GrzegorzOledzki I suppose so (without seeing what you see): the last commimt will be replaced by the amended one. That is the all idea of amending the (last) commit. – VonC Jan 31 '14 at 09:08
-
How do you unselect some commited files this way? – user2340939 Feb 13 '15 at 09:45
-
@user2340939 not sure if the GUI supports unstaging. You still can select the file and "reset" it (mixed reset): that will unstage it. And the next call to the "Git staging" view will reflect that. – VonC Feb 13 '15 at 09:50
-
@VonC but there are no files listed under "Staged Changes", there are only uncommited files under "Unstaged Changes". – user2340939 Feb 13 '15 at 10:50
-
@user2340939 so when you ask about "commited files", are you talking avout files that are already committed? It would be best to ask a separate question, with a screenshot representing your issue. – VonC Feb 13 '15 at 12:35
-
@user2340939 then you would not see any of those committed files in the "Git Staging" view. Meaning, to get back to your original question, which was "How do you unselect some commited files this way?", you don't. What do you mean exactly by "unselect" by the way? – VonC Feb 13 '15 at 13:36
-
@user2340939 you said " there are only uncommited files under "Unstaged Changes": those can be untracked files (in which case they were never committed) or tracked but modified files. Why are you looking at the "Git Staging" view to "unselect" committed files? – VonC Feb 13 '15 at 13:37
-
@VonC TortoiseGIT, for example, allows you not only to change the commit message with "amend commit" operation, but also exclude selected files from the last commit. – user2340939 Feb 13 '15 at 13:40
-
@user2340939 mmm... again, a fresh new question, with lots of details and screenshot would help illustrate the problem here. – VonC Feb 13 '15 at 13:44
-
@VonC i tried using amend previous commit but it leads to rejected non fast forward.And if i do force update then the previous comment is replaced with new one.Do I need to always force update while amending?Or i am going wrong somewhere? – aakansha Jul 29 '15 at 15:51
-
@aa1992 yes, an amend will lead to a force push. (http://stackoverflow.com/q/253055/6309) (http://stackoverflow.com/a/3968449/6309) – VonC Jul 29 '15 at 17:32
-
I use the TeamSynchronizingPrespective > History View > Modify (submenu) > Rework . Finally this opens a popup where I can edit the old commit message. – 99Sono Nov 23 '19 at 12:31
-
@99Sono Thank you. I have included your comment in the answer for more visibility. – VonC Nov 23 '19 at 23:28
-
It's not "Rework", its "Reword" – peq Feb 07 '22 at 09:45
-
@peq Thank you. I have edited the answer accordingly, and added a reference to the reword feature. – VonC Feb 07 '22 at 09:50
You can select the commit and right click, then:
Modify -> Edit
to rebase onto that commit, amend it and then continue.

- 827
- 10
- 14