Tuesday, March 18, 2014

Commit new changes to last commit

If you ever find that you accidentally left something out of your last commit, be it a file or an extra change to a file that you just committed, don't worry. It can easily be fixed All you have to do is stage the extra changes like you would for a normal commit:

git add .

And then just commit with the --amend argument.

git commit --amend

If you don't specify a commit message with -m you will be prompted with the previous commit message as a default. When you're done you can check git log --stat to see your amended commit with the extra changes.

No comments:

Post a Comment