Git modifies commit information

Git modifies commit information

①:git log

Check the commit log and find the commit to modify
insert image description here


②:git rebase -i HEAD~n

1. Switch to the commit that needs to be modified. n is the serial number of the commit. If you want to modify the latest commit message, use git rebase -i HEAD~1

insert image description here
2. Press i to enter edit mode
insert image description here
3. Change pick to edit, press ESC to exit edit mode, then enter: wq to save and exit VIM

insert image description here

③:git commit --amend

insert image description here
Press i to enter the editing mode, modify the content that needs to be modified, press ESC to exit the editing mode, and then enter: wq to save and exit VIM
insert image description here

④:git rebase --continue

insert image description here

success

Guess you like

Origin blog.csdn.net/qq_31939617/article/details/131978750