Chapter 16. Advanced Manipulations

In this chapter, we discuss some advanced commands for manipulating Git repositories. These commands range from manipulating files to searching for commits and even support for analyzing and changing a repository to specific requirements. As you already know, manipulating Git repositories does have its consequences, specifically when executing operations that change the repository’s Git commit history. As always, proceed with caution when executing such commands.

Interactive Hunk Staging

It’s a bit of an ominous moniker; however, interactive hunk staging is an incredibly powerful tool that’s used to simplify and organize your development into concise and easily understood commits. If anyone has ever asked you to split your patch up or make single-concept patches, chances are good that this section is for you!

Unless you are a super coder and you both think and develop in concise patches, your day-to-day development process probably resembles that of other developers (including us): a little scattered, perhaps overextended, and likely containing several intertwining ideas. One coding thought leads to another, and pretty soon you’ve fixed the original bug, stumbled onto another one (but fixed it!), and then added an easy, new feature while you were there. Oh, and you fixed those two typos as well.

And, if you, like us, appreciate having someone review your changes to important code before you ask for it to be accepted upstream, chances ...

Get Version Control with Git, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.