C. S. Duke C. S. Duke - 1 year ago 127
Git Question

How do I add a file to the last local commit?

Sometimes I forget to add some files before commiting. With Mercurial I fix it this way:

  1. hg qinit

  2. Convert commit to patch

  3. Update patch

  4. Convert patch to commit

Can I do anything like this with Git?

Answer Source

You are basically trying to change your last commit in Git. This is possible and quite simple.

git commit --amend is used for this purpose.

The following page gives a detailed example.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download