I was working on git and found that the name under my old commit message was wrong.
It takes a lot of effort to change it using git reset head~1.
I haven’t pushed it yet.
I tried to use git commit –amend, but when I go to the commit and enter this command, an editing window appears, but I don’t know how to save it.
Please help.
I checked out the git commit I wanted to change.
Then I typed git commit –amend.
The editing window came up, so I tried to delete the original git name and save it, but I don’t know how to save it.
8
probably its vim
or vi
, you just need to enter esc
then shift + ;
and type ‘wq’ and hit enter
. please try and check the vim tutorial in freecodecamp .
update:
you need to find the commit which you want to update comment
HEAD = hash of the commit
git rebase -i HEAD
it opens interactive mode to modify your commit for eg:
pick 123abc First commit
pick 456def Second commit
reword 789ghi Commit you want to change
pick 101jkl Fourth commit
change pick
to reword
for commit which you want to change
hit ctrl + x
and y
and hit enter
now it will open the commit that you want to change
edit your commmit and exit with ctrl + x
and y
and hit enter
4