git-debubble — Eliminate merge bubbles from a git repository


git-debubble [ -d ] [ -u | revision ]


git-debubble is a cleanup tool for people who hate merge bubbles.

Normally, starting from the revision you specify, it turns all later revisions into a patch sequence, then attempts to replay them onto a new branch named $HEAD-debubbled, where $HEAD names the current branch. If the replay succeeds, the branch names are shuffled so that the debubbled branch is named $HEAD and the old branch becomes $HEAD-bubbled.

Tags are not moved from the old branch to the new. Any remote references attached to the original branch also stay with it. (This is why -d is not the default, so as to not silently lose information about remotes and tags.)

Various sanity checks are applied to prevent you from shooting yourself in the foot. The command will fail noisily if patch files already exist in the repository, or if replay fails, or if a branch rename would collide with an existing branch, or (in the case of undo) if a branch that is expected to exist does not.

The effect of thus tool can be approximated with the git rebase options --onto and -f, but without the safety checks and the option to undo.

The usual caveats about surgery on parts of the repository DAG that have been pushed apply. If you touch public commits with this you will probably need to do a "git push --force --mirror" afterwards.


Undo. Look for a branch created from the current one by the result of a previous git-debubble and undo it.
Delete. After a debubble, remove the old branch with the bubble(s) still in it. After an undo, remove the debubbled branch. The sequence "git-debubble FOO; git-debubble -u -d" should be a no-op.


Revision commit dates are set to the author date. Ideally, they should be preserved even if they were different.


git-branch(1) git-checkout(1) git-rebase(1)


Not yet part of the git(1) suite