Re: WANTED: patch splitting tool - waypoints
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:48:44
Bron Gondwana [off-list ref] writes:
Hi, My toolkit is missing a tool. I've never seen it or anything like it, but I can describe it - and hopefully someone else knows if it exists. It's basically a combination of git rebase -i and git add -p.
I guess you named it: git add -p.
So the journey A => B becomes the journey A => W => B.
Just checkout B, then
git reset HEAD^
This will reset your _index_ to the state of A (which happens to be
HEAD^, the ancestor of HEAD). Now, you can
while !happy; do
git add -p # select patch hunks
git commit # Create an intermediate commit
done
git commit -a # Re-create commit B
The tool allows you to quickly choose which hunks to add to patch(A=>W) and which to add to patch(W=>B), but also lets you make edits to the intermediate state easily so that W will compile even if some bits of the patch were intermingled.
Then, "git stash --keep-index" between "git add -p" and "git commit", and "git stash pop" afterwards.
And a graphical/ ncurses interface
then, replace "git add -p; git commit" with "git gui", which will let you select hunks and commit from a GUI. Note that "rebase -i" is not strictly needed here, but you can apply the above flow within a "edit" command of "rebase -i", so it's a nice complement. -- Matthieu Moy http://www-verimag.imag.fr/~moy/