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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s