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

Written by Sahil Bhatacharya in Solving Mistories

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

Sign up below to receive updates, tips and more handy tutorials when git screws up. It’s good stuff & I don’t spam.