Book Image

Git for Programmers

By : Jesse Liberty
Book Image

Git for Programmers

By: Jesse Liberty

Overview of this book

Whether you’re looking for a book to deepen your understanding of Git or a refresher, this book is the ultimate guide to Git. Git for Programmers comprehensively equips you with actionable insights on advanced Git concepts in an engaging and straightforward way. As you progress through the chapters, you’ll gain expertise (and confidence) on Git with lots of practical use cases. After a quick refresher on git history and installation, you’ll dive straight into the creation and cloning of your repository. You’ll explore Git places, branching, and GUIs to get familiar with the fundamentals. Then you’ll learn how to handle merge conflicts, rebase, amend, interactive rebase, and use the log, as well as explore important Git commands for managing your repository. The troubleshooting part of this Git book will include detailed instructions on how to bisect, blame, and several other problem handling techniques that will complete your newly acquired Git arsenal. By the end of this book, you’ll be using Git with confidence. Saving, sharing, managing files as well as undoing mistakes and basically rewriting history will be a breeze.
Table of Contents (16 chapters)
11
Finding a Broken Commit: Bisect and Blame
13
Next Steps
14
Other Books You May Enjoy
15
Index

Rebasing, Amend, and Cherry-Picking

If you say "rebasing" to most novice Git programmers, they burst into tears and run screaming from the room. But the truth is that this is only because of how it is explained in so many books and magazines, where rebasing is (correctly but confusingly) shown with diagrams of commits being copied and moved along with dense and technical text.

In truth, rebasing is not hard to understand, and it is not hard to do if you understand what it is for. In this chapter, we will review rebasing without fear.

Rebasing is a command that allows you to take a feature branch and place it on the tip of another branch. We'll discuss how, and more importantly why, you would do this.

Amending is a quick command that allows you to modify the most recent commit. You can use this to add a file you forgot to put in the commit or to fix up a botched message.

Cherry-picking is the ability to take one or more commits from a branch and apply...