Hegwin.Me

Thoughts grows up by feeding itself with its own words.

Git amend last commit

Git修改上一次提交

No one is immune to mistakes. Sometimes after a git commit, you may find something missing. At that point, if you haven't pushed yet, you can use amend to modify the last commit more easily.

git commit --amend

If you're just modifying the commit message, you can just change the text in your editor for git and then save it to close.

If you modify or add files, just put what you need to commit into the stage and then commit it, for example:

git add .
git commit --amend
< Back