Git: Amending last commit

If you accidentally forget to add a file or need to make an additional change to a file when working with git, don’t fret, the solution is simple.

1. Make the change and add it locally with

git add .

2. Commit the change with

git commit --amend

3. You can then verify that this second commit has updated the previous one by running a

git log --stat
Advertisements