Summary
This chapter, along with Chapter 8, Advanced Branching Techniques, provided all the tools required to manage a clean, readable, and easy-to-review history of a project.
You learned how to make history cleaner by rewriting it in this chapter. You also learned what rewriting history means in Git, when and why to avoid it, and how to recover from an untimely upstream rewrite. You have learned to use an interactive rebase to delete, reorder, squash and split commits, and how to test each commit during the rebase. You know how to do a large-scale scripted rewrite with filter-repo
, as well as how to edit commits and commit metadata and how to permanently change history, such as by splitting it in two. You also got to know some third-party external tools, which can help with these tasks.
You learned what to do if you cannot rewrite history: how to fix mistakes by creating commits with appropriate changes (for example, with git revert
), how to add extra information to the existing commits with notes, and how to change the virtual view of the history with replacements. You learned to handle reverting a faulty merge and how to re-merge after a reverted merge. You learned how to fetch and publish both notes and replacements.
To really understand advanced history rewriting and the mechanism behind notes and replacements, this chapter explained the basics of Git internals and low-level commands that are usable for scripting (including scripted rewrite).
The following chapter, Chapter 11, Managing Subprojects, will explain and show different ways to connect different subprojects in one repository, from submodules to subtrees.
In the subsequent chapter, Chapter 12, Managing Large Repositories, you will also learn techniques to manage (or mitigate managing) large-size assets inside a repository, or large numbers of files in a repository. Splitting a large project into submodules is one, but not the only, way to handle this issue.