Have you ever had a typo in your git commit message and thought of editing it?
Have you ever thought of small change in code which should be merged to last commit?
Then this post will help you to edit commit message in git or add some more changes into the previous git commit, provided you haven’t pushed the commits to remote repo. One more thing to keep in mind that you can use this tip only on HEAD commit.
The – -amend option for git commit will help you to do it. According to the git help commit it is an equivalent for
$ git reset --soft HEAD^ $ ... do something else to come up with the right tree ... $ git commit -c ORIG_HEAD
If you want to edit the commit message of the HEAD commit
If you want that commit to include the changed files use git add before using the above command
Have a happy and neat Git commits 😉