ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

One Git commit from feature/branch to master

release
Date: 2015-01-30
Tags: git

Using git, I sometimes sense pressure to make a meaningful, ever-lasting commit message. Am I using the appropriate level of detail when making commit messages? Is a WIP (Work in Progress) commit dirtying up git history? Any cognitive tension becomes a small friction to committing and sharing code.

Commit often, early, and freely in feature branches. Communicate with your team, and when it comes time to finalize a Pull Request, rest as ease, knowing you can cleanup your history with a clean diff of code.

Many developers I work with love to use rebase, and I've used it quite a bit myself. Though, I've also seen a handful of times where commits mysteriously vanish (due to team coordination and branch management, not due to any flaw of Git).

I'm starting to the following method a bit more when I'm ready to finalize a Pull Request from a feature branch that has several commits that I'd prefer to commit as one.

Generate a diff between 2 git branches

git diff branch_name_from branch_name_to --binary > name_of_diff.diff

Notice the use the --binary flag if you have files, like images or pdfs.

Then, create a new branch off of branch_name_from - for instance:

git checkout -b master new_branch_name

then with new_branch_name checked out, apply the diff

git apply name_of_diff.diff

Now, you'll have one clean commit, based on the diff between two branches.

By Ryan Wold · © 2015–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.

Leave a tip

Tips go directly to a Bitcoin SV address I control — peer to peer, no platform in between. A few thousand satoshis is a fraction of a cent; it's the gesture that counts.

From any BSV wallet

Scan the QR code with your wallet's camera, or copy the address.

177DwUfSTW8RkFBJzYYcgr1YB8ngbhTYAc

With HandCash or any paymail wallet

Paymail is an email-style address for Bitcoin wallets. Send any amount to afomi@handcash.io

First time using Bitcoin? Yours Wallet is an open-source browser extension wallet, and HandCash is an easy mobile wallet — either takes a minute to set up.

Prefer regular money? Support via OpenCollective.