HeadlinesBriefing favicon HeadlinesBriefing.com

Git History: A Powerful Alternative to JJ

Hacker News •
×

Working with parallel Git changes can be complex, often involving difficult rebase commands. While tools like jj are often proposed as solutions, they require a complete workflow switch. The author, after repeated attempts to adopt jj, found a compelling alternative within core Git itself: the `git history` command.

Introduced across Git releases 2.54 and 2.55, `git history` offers subcommands like `fixup`, `reword`, and `split`. `git history fixup` allows fixing old commits by folding staged changes into them, automatically updating all branches that contained the original commit. This is more comprehensive than `git rebase --update-refs`. `git history reword` modifies commit messages and rebases subsequent commits, useful for refining descriptions. `git history split` divides a single commit into two, enabling finer-grained commits.

A key advantage of `git history` is its atomicity; it never leaves the repository in a broken state, refusing operations that could cause conflicts. While it doesn't handle conflicts as robustly as jj, the documentation suggests this limitation may be addressed in the future. For many of the benefits associated with jj, `git history` provides a powerful, integrated solution without requiring new software installation.