Git Articles that keep me from losing my HEAD

A collection of interesting and useful git guides for you to bookmark

We’ve all felt the inevitable burn of doing something stupid with git at one point or another. Whether you’re using StackOverflow answers to figure out what a merge conflict is, or you’ve called upon the mercy of git push --force and now everyone is after you with pitchforks: we’ve all be there at some point or another.

Introduction

I want to create a place for people to share articles that have helped them master git (does that at least count as a half-pun?). This article is a work in progress. As such, you might want to come back in the future, or even suggest edits of your own in the responses section. This list was created to serve as a “Bookmarking” page for me, and I hope it can do the same for you, too. Happy exploring!

1. There’s no such thing as magic

Magic might exist in your favorite TV show, but not in computer science. In this field, there are only two sources of truth: bits and logic. Git isn’t a magic genie installed on your computer to make your life easy (or hard). It’s a version control system that enables you to do some seriously cool things- if you know how it works. As such, I cannot recommend the article Git from the inside out by Mary Rose Cook enough. Not only is the article based on real examples, but she digs deep into the internal workings of Git, and exposes what actually happens under-the-hood. If you’re gonna learn git, you might as well base your knowledge on the truth instead of trying to remember convoluted command-line strings in hopes that you’ll glean some insight.

2. Revert, Checkout & how they modify the Git tree

Now that you have a basic understanding of the three “tree” structures that underpin Git (working directory, index and HEAD), let’s learn how to manipulate them! Using real-world examples and great illustrations, this article shows how git revert and checkout modify your repository and working directory in a predictable manner. Big thanks to Juan Campa for linking this resource.

3. Starting a new git repository

Start from the beginning- like the very beginning. How do you start a repository? What happens if you’ve already created it on your local machine, but not on GitHub and visa-versa?

4. Wait! Don’t re-clone just yet!

We’ve all been there. You feel like you’ve messed things up so poorly, you might just need to delete the repository and re-clone it from GitHub. Read this before you succumb to that desire. Yes, it’s a StackOverflow link, but the discussions here are pretty good. I recommend you read through what everyone has to say.

Does this article feel incomplete? Good! Leave your additions or modifications in the responses section and let’s build an amazing reference together.