Splitting a Git Commit
Dividing a Git Commit
Published: 2026-08-12
The process of splitting a git commit has become remarkably straightforward. Instead of wrestling with complex rebase sequences, you can now simply utilize the following command:
git history split ${REF}
The Workflow
The operation follows a logical progression where one large commit is decomposed into two smaller ones:
The step-by-step process is as follows:
- The system prompts you hunk by hunk to select the specific changes to include in the initial commit.
- An editor opens to allow you to write the message for the first commit.
- An editor opens again for the second commit's message.
It truly couldn't be more intuitive.
Visualizing the Split
Implementation Example
To execute this, run the command in your terminal:
git history split HEAD~1
A Note on Community Knowledge
P.S. If you look at Stack Overflow, the primary discussion on splitting commits still promotes
the old and cumbersome approach.
There is a stark contrast between the popularity of an answer and its actual utility, as shown below:
| Answer Rank | Approach | Upvotes | Status |
|---|---|---|---|
| Top Answer | Complex/Manual | 2,656 | Outdated |
| 20th Answer | The Correct Way | 2 | Underappreciated |
It is a shame that the most efficient method remains largely ignored in favor of the legacy workflow.