Git is a version control Swiss army knife. A reliable versatile multipurpose revision control tool whose extraordinary flexibility makes it tricky to learn, let alone master.

As Arthur C. Clarke observed, any sufficiently advanced technology is indistinguishable from magic. This is a great way to approach Git: newbies can ignore its inner workings and view Git as a gizmo that can amaze friends and infuriate enemies with its wondrous abilities.

Rather than go into details, we provide rough instructions for particular effects. After repeated use, gradually you will understand how each trick works, and how to tailor the recipes for your needs.


Other Editions


Dustin Sallings, Alberto Bertogli, James Cameron, Douglas Livingstone, Michael Budde, Richard Albury, Tarmigan, Derek Mahar, Frode Aannevik, Keith Rarick, Andy Somerville, Ralf Recker, Øyvind A. Holm, Miklos Vajna, Sébastien Hinderer, Thomas Miedema, and Joe Malin contributed corrections and improvements.

François Marier maintains the Debian package originally created by Daniel Baumann.

JunJie, Meng, JiangWei, Rodrigo Toledo, Leonardo Siqueira Rodrigues, Benjamin Bellee, and Armin Stebich worked on translations of this guide.

My gratitude goes to many others for your support and praise. I’m tempted to quote you here, but it might raise expectations to ridiculous heights.

If I’ve left you out by mistake, please tell me or just send me a patch!

Free Git hosting

  • hosts free projects. The first Git hosting site. Founded and maintained by one of the earliest Git developers.
  • is another Git hosting site aimed at open-source projects.
  • hosts open-source projects for free, and private projects for a fee.

Many thanks to each of these sites for hosting this guide.


This guide is released under the GNU General Public License version 3. Naturally, the source is kept in a Git repository, and can be obtained by typing:

$ git clone git://  # Creates "gitmagic" directory.

or from one of the mirrors:

$ git clone git://
$ git clone git://