Chapter 8. Keeping History Clean
The previous chapter, Merging Changes Together, described how to join changes developed by different people (as described in Chapter 5, Collaborative Development with Git), or just developed in a separate feature branch (as shown in Chapter 6, Advanced Branching Techniques). One of the techniques was rebase, which can help bring a branch to be merged to a better state. But if we are rewriting history, perhaps it would be possible to also modify the commits being rebased to be easier for review, making the development steps of a feature clearer? If rewriting is forbidden, can one make history cleaner without it? How do we fix mistakes if we cannot rewrite history?
This chapter will answer all those questions. It will explain why one might want to keep clean history, when it can and should be done, and how it can be done. Here you will find step-by-step instructions on how to reorder, squash, and split commits. This chapter will also describe how to do large...