Nathan Hoad


Git: Amend your last commit

Git has a number of awesome features; Not least of all is the ability to amend the previous commit. If you ever find that you accidentally left something out of your last commit, be it a file or an extra change to a file that you just committed, don't worry. It can easily be fixed

All you have to do is stage the extra changes like you would for a normal commit:

git add .

And then just commit with the --amend argument.

git commit --amend

If you don't specify a commit message with -m you will be prompted with the previous commit message as a default.

When you're done you can check git log --stat to see your amended commit with the extra changes. For more information, check out Git's 'commit' documentation.

Hope that was helpful.

If I just made your day a little better then thank me with a coffee: