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

Five places

As a programmer I think of Git as divided into five places:

  1. The work area
  2. The index (staging area)
  3. The local repository
  4. The remote repository
  5. The stash

Let's begin by examining each of these in turn.

The work area

The work area is where your current files are. That is, if you were to open Windows Explorer and navigate to the directory you cloned to, you would see the version of the program you were currently working on. If you were to open Visual Studio 2019, these are the files that would be in the Solution Explorer. Again, the work area is where your current files are; if you open Visual Studio on your project, the files in the work area are what you will see. As you change branches (see below) the work area is updated with the appropriate files. This can be one of the hardest concepts in Git: when you change branches you change the files that are in your work area – that is, the files for that branch...