Welcome to Amsterdam

Since DutchPHP is coming up and I’ve noticed a few people asking for tips, I thought I’d lay out some Amsterdam do’s and don’ts. The city’s traffic can be pretty overwhelming and, like everywhere, there’s a few quirks and unwritten behavioral rules you might want to know about. Also I’ve made a few recommendations for places to visit 🙂 Continue Reading


Read More

Let’s dust off the toolbox (for 24 Days in December)

Andreas Heigl from 24 Days in December invited me to write something for today’s publication. Thank you for having me! Here’s my contribution.


Read More

Retrospective: The Bear

At a previous employer, when I took over the Scrum Master role from someone else, I did the first retro as sort of a light-hearted joke. Just to ease into it. Because the previous Scrum Master had been a fan of making all sorts of elaborate drawings for retrospectives (little did I know it would be one of my favorite things about being a SM), I decided to just randomly draw a bear and kind of wing a retrospective concept based on the drawing.

It actually turned out pretty useful, and I did it a few times after that. Which is why I share it now. Continue Reading


Read More

Git Legit cheatsheet

I’ve given my talk about best practices in Git a few times now, and I’ve had several people come up to me asking if I’m going to upload the slides, or “what was that one Git command again?” I thought it might be a good idea to offer a cheatsheet based on the talk to refer them to in the future. Maybe throw in some handy resources.

So here you go 🙂 There’s a lot more options to Git than this, but this is what I use daily to easily keep my commits atomic and my sanity in tact. Continue Reading


Read More

Atomic commits will help you git legit.

I’ve given a talk (Git Legit) a few times that basically makes a case for atomic commits. I’ve created a cheatsheet to go with it, but then I realized there’s no point to the cheatsheet if you don’t use atomic commits. Then I realized you won’t start using atomic commits until you know the benefits. So, here’s basically a short recap of my talk if you haven’t seen it.

When I started using Git, I used it as a save point. Similarly to when you’re playing a video game, made a bunch of progress, and think “I should probably find a save point or I’ll lose all my progress”. This makes a lot of sense; we’re used to this linear, “checkpoint” mindset. But I shifted from the “checkpoint commit” mindset to atomic commits and haven’t looked back once.

Firstly, what are atomic commits?

Atomic commits, in short, are what they sound like: atomic. I feel like there’s basically three features a commit needs to have to be atomic:

What is an atomic commit?

]1 (yes, this is a direct screen grab from one of my slides)

In short, all your tests need to be green on every commit and your application shouldn’t break. Every commit has a clear commit message and a description detailing what the purpose of these changes was. Lastly, the commit should only have changes pertaining to one fix or feature (or whatever you were working on). Don’t have commits where you “fixed that bug and also implemented the feature and then also refactored some class”.

Why, you ask? Well,

Atomic commits have big benefits

For me, one of the biggest advantages of atomic commits is spending a LOT less time solving merge conflicts. Because all your commits are concentrated to a certain part of the code, merging and rebasing become so, so much less painful. You’ll have a lot more context to the conflict and your conflicts will become smaller and much more rare. Any time you need to rebase your branch will go much more smoothly. Also, dropping and cherry-picking commits become very handy options.

Atomic commits also make code review much more pleasant. You’ll be able to review commit by commit, which will give your brain less information overload and offer a clear context of what you’re reviewing. After all, the commit is about one fix or feature only, and the message and description are clear and concise. Having this context and diminished confusion will not only make reviewing more pleasant; it will make you better at reviewing. This commit by commit review isn’t possible if you’re using git like a save point, creating checkpoint commits. That’s because they’re based on time, not on a portion of the code. Consequently, you might request changes or comment on one commit, when that particular change was already undone in a next commit. You just hadn’t gotten to that commit yet. Very inconvenient.

Lastly, your history becomes much more relevant. Without atomic commits, it becomes difficult to be descriptive in your commit messages, since you’re touching different areas of the code and not focusing on one central theme per commit. So, at a glance, people won’t be able to tell what happened in your history. Take this scenario:

You fix a bug. Commit. You realize you broke something else in the process. Another commit. You address comments on your PR. Commit. And so on, and so on. You end up with this:

Anyone looking through your history won’t know what commit actually fixed the bug. Without the context of your PR, the upper commit messages have no meaning. Every commit captures your application in a broken state, so you can’t revert comfortably. All you really wanted was to fix the bug. So amend your initial commit until you’ve actually fixed the bug.

How, you ask? Well, here’s

How to keep your commits atomic

While on your task/feature/whatever branch, group all the changes to their relevant commits. This means you’ll need to change your commits if you make any changes to them afterwards. This is possible through interactive rebase and amending.

Please note that any time you change a commit, it changes the commit hash. This means that if you try to push it to your origin, it will be rejected (your origin thinks the commit doesn’t belong there), unless you git push -f. You should probably protect master and any other important branches.

My cheatsheet lays out some handy commands Git offers to help you keep your commits atomic. It takes some learning and getting used to, but you’ll breathe a lot easier once you do.


Read More

× Close