Have you ever faced a situation where you left something out of your last commit ? It may be a file or an extra change to a file you just committed.
Such kind of scenarios can easily be handled with Git amend command .
How does it work ?
1. Just add the file using git add ( Like what we do for normal commit ).
git add <file>
2. Now commit the changes with -amend argument.
git commit --amend
If you don't specify a commit message with -m , git picks the previous commit message as a default.
How to see the amended commit ?
We can use git log --stat to see the amended commit with extra change .
You can also see this page for more information on git commit.