Git commit — amend submit information operation

Time:2021-2-26

amendTranslation into Chinese: modification

1. Modify the submission that has not been pushed

//Modify last submit

git commit –amend

//Enter the comment page and modify it

//Save and exit after modification

2. Modify the pushed submission

//Modify last submit

git commit –amend

//Enter the comment page and modify it

//Save and exit after modification

//Force push

git push –force-with-lease origin master

Supplementary knowledge:Git uses amend to fill in missing files

Applicable scenario: some files were omitted in the last submission, which need to be supplemented, but I don’t want to commit again

git commit -m ‘initial commit’
git add forgotten_file
git commit –amend –no-edit

This operation will modify the content submitted last time, but it will not ask you to edit the submitted information. The message of the last commit will remain

The above git commit — amend submit information operation is the whole content shared by Xiaobian. I hope it can give you a reference and support developer.