The Git cookbook

Git, you either love it for its power or hate it for it's ui. While I'm a trained git apologist and love its power and flexibility, I've also done a lot of git user support at work and in the #git IRC channel. I understand the frustration of the jumble of jargon, inconsistency and arcana that is the git UI and will help you dive into it!

If you have questions, comments or suggestions about any of the articles, please leave a comment on the article or in the issue tracker on GitLab. Suggestions for new articles are also very welcome!


Describing the relationship between commits

Posted on Sun 20 March 2016 in Effective git usage • Tagged with hooks, describe, ancestor, merge-base, branch, rev-parseLeave a comment

Unless you have only one commit in your repository, no commit stands on it own and all commits can be related to each other. These relationships can be described in multiple ways, from exact revision walking paths to a vague 'are these commits even related'?

Continue reading

Quickly seeing the age of your branches

Posted on Sat 12 December 2015 in Plumbing is awesome • Tagged with plumbing, for-each-ref, merge-base, log, branchLeave a comment

Want to know how old all your branches are? You can of course browse your logs, but git can tell you what you want to know in one command (if you're willing to call some shell golfing a single command)

Continue reading

Deleting branches that have been merged

Posted on Sat 07 November 2015 in Repository maintenance • Tagged with branch, remoteLeave a comment

Learn how to to find branches that have been merged into your main branch and how to delete them.

Continue reading

The meaning of refs and refspecs

Posted on Sat 07 November 2015 in Background information • Tagged with refs, branch, tag, remote, github, pull-request, notes, gerrit, bisect, merge, filter-branch, replace, stashLeave a comment

Refs are one of git's core concepts. Learn here about all the different types of refs (many more than just tags and branches) and how they differ from each other.

Continue reading

Recovering from a detached head

Posted on Thu 05 November 2015 in Digging through history • Tagged with checkout, branch, bisect, submodules, refsLeave a comment

Unlike in real life, a detached head is pretty common in git. Find out how you can get into this situation and how to recover from it.

Continue reading

Showing all branches and their relationships

Posted on Sun 01 November 2015 in Digging through history • Tagged with log, branchLeave a comment

You don't need a graphical interface to see all your branches and their relationships.

Continue reading