We can also use the --amend method to add missing files to our latest commit. Let's say you needed to add the README.md file to your latest commit in order to get the documentation up to date, but you have already created the commit, though you have not pushed it yet.
You then add the file to the index as you would while starting to craft a new commit. You can check with git status that only the README.md file is added:
$ git add README.md $ git status On branch master Your branch and 'origin/master' have diverged, and have 1 and 1 different commit each, respectively. (use "git pull" to merge the remote branch into yours) Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: README.md
Now, you can ...