Jump to the navigation menu

Tidy then push

As I said in yesterday's email, sometimes you change your mind whilst working on something.

Maybe you change your approach and have a commit that supersedes an earlier one, fix a typo, or find a bug and need to revert a commit.

If you're pushing your changes to a branch for review, I suggest using git rebase to clean up your commits.

You can squash the typo fix into the commit that introduced the typo, or remove the original implementation that you later moved away from.

Whilst there is an option to squash all the commits when merging, I don't like it and prefer people to tidy their commits before pushing.

This means the commits are easier to review and you can keep the original commit history and all the context within the messages instead of a generic Merge commit.. message.

- Oliver

Was this interesting?

Sign up here and get more like this delivered straight to your inbox every day.

About me

Picture of Oliver

I'm an certified Drupal Triple Expert with 18 years of experience, a Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.