Strategic rebasing

The Raku Programming Language Collect, Conserve and Remaster Project

Strategic rebasing

Originally published on 31 December 2015 by Carl Mäsak.

Just a quick mention of a Git pattern I discovered recently, and then started using a whole lot:

There are several things I like about this pattern.

First, we’re using the full power of Git’s beautiful (distributed) graph theory model. Basically, we’re running the branch in two different environments: one where the thing is broken and one where the thing is fixed. Git doesn’t much care where the two base commits are; it just takes your work and reconstitutes it in the new place. Typically, rebasing is done to “catch up” with other people’s recent work. Here, we’re doing strategic rebasing, intentionally starting from an old state and then upgrading, just to confirm the difference.

Second, there’s a more light-weight pattern that does this:

This is sometimes fully adequate and even simpler (no branches). But what I like about the full pattern is (a) it prioritizes the fix (which makes sense if I get interrupted in the middle of the job), and (b) it still works fine even if the problem was fixed long ago in Git history.

Git and TDD keep growing closer together in my development. This is yet another step along that path.