Entries tagged “references”

In the last few years, git has gained a lot of popularity in open source projects, howether, newcommers, and even seasoned contributors, often seems to struggle with its interface.

There is a simple reason to that, git has beautiful internals, but you don’t care about that, you want to use it, the issue is that its interface only make (some) sense (it’s not completly consistent) in the light of its beautiful internal model.

On top of that, the initial git documentation was, to say the least, indigest, technically correct, but not really helpful, again, because it explained how things worked, not how to use them.

Howether, a good number of resources have poped up while git was gaining popularity, here is my shortlist of favorite resource, in order of complexity, to get you accustomed with it.

git - the simple guide (i usually find this one by googling “git no deep shit”, easy to remember), this colorful guide can be read in 5-10 minutes, and will get you started, sure, it glosses over details, but it’s a good startpoint, and the format makes it easy to read.

git for 4 and up This video will show you how git works with toys and manual construction of commit trees (the famous DAG) it’s a great way to understand the model, and behavior of git, you’ll see it’s, in fact pretty simple.

think-like-a-git This one will use, and really deserve, one or two hours of your time, it’s not the best start point, but it will make things a lot clearer if you have been using git for some time and still feel uneasy when less-common situations, it’ll make clearer to you that, really, nothing is ever an unrecoverable mistake with git.

Pro Git Ok, this one is now more or less the official documentation, and i rarely go for it, but when you want a definite answer, or face a complex situation, it’s a really, really, complete resource, and it’s translated in a lot of languages, like even human languages, isn’t that great?

On top of that, i’ll add a few of my own tips:

-p flag

Look for the “-p” flag in commands, you can use it on add/commit/reset/stash and others, its exact behavior of course depend of the situation, but the general idea is that when you want to see/review each part of the change, it’s what you want. I basically never use “git add” without “-p”, this way i see exactly what i’m about to commit.

reflog

git reflog

this one will show you where you’ve been, regarding commit ids, recently, if you are lost after a rebase/reset/checkout, and just want to go back, it can save you a lot of trouble.

aliases

If you do something often, or if you don’t do it often enough to remember the right options, do an alias for it, here are a few of my most useful ones.