On Fri, Jul 29, 2016 at 10:57:26AM -0700, James Bottomley wrote: > On Fri, 2016-07-29 at 17:52 +0000, Bird, Timothy wrote: > > I've been trying to convert to a pure git-based workflow, but for > > some reason git rebase -I always seems to give me problems. It > > always takes me much longer to just move some hunk from one > > commit to another than it did in quilt using the patches and vi. > > I do this too, but I also work with the diff when moving hunks. What I > do is: > > git checkout > git show > tmp.diff > vi tmp.diff so it only has the hunks I want to remove > patch -p1 -R < ~/tmp.diff another alternative: git checkout -p HEAD~ and... > git commit --amend -a > git checkout > patch -p1 < ~/tmp.diff > git commit --amend -a git checkout -p (assuming you're moving the hunk further towards the head of the branch). thats easy to do from a rebase -i, as you have all the commit ids right there and can just add a line: x git checkout -p > > It's a bit cumbersome, but you can script it. If there are better ways > to do it, I'm interested. I often find myself just splitting it up with rebase -i. I.e. just duplicate the removal commit, and add "x git checkout -p HEAD~" in between them. The second pick will end up just with the hunk you've removed. Then you can mark it as a fixup on a second run of rebase -i, or even on the first run using commit --fixup and rebase --autosquash: pick abc removal commit x git checkout -p HEAD~ pick abc removal commit x git commit --amend --fixup add_commit For more complicated extractions where checkout -p HEAD~ gets confusing or when you want to move a hunk backwards while avoiding nearby conflicts, precede the removal commit with: x git checkout -p Cheers James