This article solves the following challenge:
Edit commit messages in Github.
Typos happen, but luckily in the case of commit messages, it is very easy to fix them:
git commit --amend # start $EDITOR to edit the message
git commit --amend -m "New message" # set the new message directly
But that’s not all git-amend can do for you. Did you forget to add a file? Just add it and amend the previous commit!
git add forgotten_file
git commit --amend
Please keep in mind that --amend actually will create a new commit which replaces the previous one, so don’t use it for modifying commits which already have been pushed to a central repository. An exception to this rule can be made if you are absolutely sure that no other developer has already checked out the previous version and based their own work on it, in which case a forced push (git push --force) may still be ok. The --force option is necessary here since the tree’s history was locally modified which means the push will be rejected by the remote server since no fast-forward merge is possible.
Evaluate complexity of present statement:
Select ratingCancelGuessingPassing knowledgeKnowledgeableExpert
Your rating: None Average: 4 (1 vote)