Hmmmm... One thing you could do is pipe the output of git diff
to a temporary place, then read it back in with git apply
:
git diff --patience <commitA> <commitB> > /tmp/patch.out
# checkout a new branch or otherwise do what you need to prep
git apply < /tmp/patch.out
That'll apply the output of the diff to the working directory, but it won't commit or stage the changes. You can then run git add -p
as you normally would, and the --patience
diff will be the changes you're interactively adding.
There's no reason you couldn't pipe diff
to apply
directly, if it better suits your workflow. It's something I do fairly regularly when rebuilding my own local branches for production integration.
Looks like you can also use it as a merge strategy, so it might be the case that instead of interactively adding the diffs, you could simply create a branch with what you want, then merge it in.