Squash git commits when merging

| Posted: - Last updated:
| Tagged git
| ~200wrds (~1min)

Today I’ve been fighting to get our test suite to run against a newly delivered Oracle 12 database. Of course, that didn’t work out of the box, so there was some debugging, trial-and-error, and cursing involved. Finally, I managed to get the build back up and running. Yay!

The commit history for this pull request was horrible and some would call it unprofessional, looking at the various commit messages written in anger.

Normally I’d squash all commits together using rebase in the feature branch and create a nice pull request. In this case I just wanted to merge this to develop so the build was working. Turns out this is rather easy:

git checkout develop
git merge --squash fix_for_oracle_12

This applies all changes from the fix_for_oracle_12 branch to your working copy, ready for you to commit in a single commit.

git commit -m "Apply workaround for Oracle DB 12"


My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.

Was this post helpful to you? Why not ☕ Buy me a coffee or use Brave Browser to send a tip.