Sometimes, when pushing commits to Github, we either use the wrong commit message or make a typographical error. Annoying right? , especially when working with a team that needs to understand the new lines of code or syntax change. Thankfully, there is an easy fix with the
amend keyword, and I'll walk you through it.
After a commit has been made like so :
git commit -m "commit message with the error"
, the amend keyword can be called to make changes to the last commit in the following manner:
git commit --amend -m "fixed message"
. the branch can now be merged by pulling the old commit and pushing the amended commit, just like nothing happened.
There you go devs, try not to panic next time there's a huge typo or any other error in your commit message, you got this!!