How to add staged changes to your previous commit in Git?

Forgot to add some files or changes in your last commit? Or remember that last thing you needed to do after you have already committed? We have a solution!

To add staged changes to the previous commit, use the following command:

git commit --amend

If you don't want to modify the commit message, you can instruct git to reuse that commit message:

git commit --amend -C HEAD

Originally Posted On: Github (k88hudson)

Subscribe to GIT.WTF!?!

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]