Thread: Do you even trunk? 🧳

The idea that a whole development team shares a single branch as the only source of truth regarding the application state is sometimes seen as scary and revolutionary.

Granted, moving to trunk-based development requires a leap of faith from developers who, for so long, have enjoyed the comfort zone of long-living branches and asynchronous work.

Paradigm shifts do not happen overnight. So, to gently nudge yourself into the right direction, start working from small things. Follow the steps below and only move to the next step once comfortable with the current one.

💡 Note: I'm assuming that at this point, you have fairly good automated test coverage and your pull requests are already tested by a CI pipeline.

1. Aggressively limit the scope of your pull requests. Keep doing this until you can't write any smaller changesets reasonably.

2. Maintain a shared branch (not main) and call it, for example, 'develop'.

3. Merge your work within a feature branch to the development branch at least once per day (this is easy after step 1).

Follow

4. Instead of creating a feature branch on your local machine, push directly to the development branch*. Again, make sure the builds stay green.

· · Web · 1 · 0 · 0

5. Remove the development branch in between and start pushing directly to the main branch with a manual step before production releases.

6. ...now you're doing trunk-based development and continuous delivery**. Congratulations! That wasn't so hard, was it?

So, what did you gain from all this? Well, shorter feedback loops, higher velocity, happier clients, and well-slept nights to name but a few.

Footnotes:

*) Have your code reviewed live while you write it (see: pair/mob programming) or after pushing.

**) If you want to go further, remove the manual deployment step and you're doing continuous deployments.

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!