Edit old commits
When coding, I usually commit in small steps to keep the history clear. But sometimes, after finishing a whole branch and preparing to open a pull request, I realize there is a small error or need to add code to a previous commit. If I keep adding that change to the latest commit, the history will be fragmented: a feature/bugfix that should be encapsulated in one commit is now scattered across many commits. My favorite solution: git rebase -i to edit old commits and consolidate changes back to their rightful place. ...