Lucas Mazza

Git Field Guide

Published on Feb 20, 2018

Git has become an indispensable tool of software development, regardless of which language or framework your team uses it. But in the other hand, it isn’t a tool that you can adopt, learn and be effective from day 1 - it takes time and guidance to master it, both in the command line the integrations and practices most teams have adopted.

I’ve put up together a guide on how I see and use git on my day to day work, that can be used as a starting both for both newcomers who are trying to grok or more experienced professionals who want to make a more effective use of it on they work.

The guide describes values to remember and strive for when using git, day to day practices and configuration suggestions that I believe are a must have for your local setup.

Values

  1. Git is more of a tool to document and communicate changes rather than storing them. As the number of people involved or time spent in a codebase grows, you will eventually find yourself reading more about what (and why) have change rather than reverting changes.
  2. Git is not trivial. All its power and usefulness can come with more complexity than your one might expect. Be humble enough to understand that you might not master it as fully as you think, and trust it to be more powerful than you currently expect it to be.
  3. Failures are usually recoverable. Whenever some git operation does not goes how you would expect (from commiting to a wrong branch to rebases with absurds conflicts) do not panic as not all is broken or lost, and commands like reflog, reset or rebase can be extremely useful to recover and fix whatever might have happened to your git tree. Oh shit, git! is a tiny but useful resource on possible git screw ups and how to fix them.

Practices

Configuration

For more configuration settings and aliases that I use (and don’t use), you can check my gitconfig on GitHub.

Copyright © 2022 Lucas Mazza