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

Merging overview

If you are on a feature branch, and the feature is sufficiently complete and tested, you will want to merge your branch back into the main branch. Some organizations let you simply merge, others (most?) require that you create a Pull Request (PR). A PR says, essentially, "Please examine my code and if you think it is right, merge it into the main branch."

Having a second (or third) set of eyes on your code before merging can save a lot of headaches later on (see Chapter 12, Fixing Mistakes (Undo), on fixing mistakes).

Often, if you've been careful (see below) you will merge without a problem. From time to time, however, you will run into the dreaded merge conflict. You'll see below a couple ways to handle that conflict.

Book

You will remember from the previous chapter that we have a directory, C:\GitHub\VisualStudio\ProGitForProgrammers, that is the home of the Books application and that we've been editing in Visual Studio...