Keeping History Clean
The previous chapter, Merging Changes Together, described how to join changes developed by different people (as described in Chapter 6, Collaborative Development with Git), or just developed in a separate feature branch (as shown in Chapter 8, Advanced Branching Techniques). One of the techniques was rebase, which can help bring a branch to be merged to a better state. However, if we are rewriting history, perhaps it would be possible to also modify the rebased commits 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 project history?
This chapter will answer all those questions. It will explain why one might want to keep a 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...