My git workflow

Optimize by using aliases

The core of a solid process for me is repeatability with minimal steps and minimal errors. How can I make it easier to perform these actions with less typing, and less remembering specific flags and configurations? The answer for git is aliases. A list of my git aliases is available online.

The process

  1. Create a new branch for each new thing
  2. Commit frequently to give myself context
  3. Rebase to make it readable
  4. Open a merge request

Create a new branch for each new thing

I create branches for everything. New prototype or experiment? Create a branch. New feature? Create a branch. Bug fix? Create a branch. New, different idea for how to implement something I’m working on right now? Create a branch off the current branch. If the branches get too messy to merge all the way back up, cherry-pick commits as needed.

Commit frequently to give myself context

Every time I add a thing that works, make a commit. Every time I add a thing that almost works, make a commit, prefixed with “WIP”. Commits are the breadcrumbs that help me find my way when I resume working on something.

Rebase to make it readable

Code and commits are read more often that they’re written; while those breadcrumbs were useful in the short term, they’ll be stale months or years from now. I always condense my changes down into the smallest meaningful set of commits I can, so that it’s easier for others to follow along without getting lost in the details.

Open a merge request

Create a request to merge my branch on whatever web-based platform the team is using to synchronize git.

Minimize adjustments

This workflow has become the pattern of my version-controlled work, and how I think iteratively about problems. While there might be an easier or more efficient way to use git for the types of things I’m using it for, those optimizations are rarely worth the friction they’ll cause.