Add More Files and Changes to a Commit Before Pushing

Add More Files and Changes to a Commit Before Pushing

After creating new files and editing existing files, we want to add them to the previous commit i.e. rewrote the previous commit.

First, add all the files to the staging area.

git commit -A

Now, commit them using the --amend flag.

git commit --amend -m "Adding index.html and app.js"