Skip to content

Fixing mistakes

"Fix previous commit"

A commit that just fixes a typo or other mistake in the previous commit should rarely exist. Instead, we can amend (git commit --amend) the last commit if we find the mistake early enough, usually before pushing. After pushing, it depends on a number of factors whether we want to replace the last commit or not. These are out of scope here, so here we assume that one either fully understands whether one can amend and force-push in the specific context or that the commit has not been pushed yet.