I'm currently working on a git branch based off of branch main
with a HEAD
of commit A
. I realized I wanted to split the work I was doing into two PRs, but I want to preserve the history properly. An idea I had was to git reset --soft main
, unstage the parts I want to separate out, and commit the remaining bits so HEAD
is now one commit ahead of main
on commit B
.
Ideally, at this stage, I would like to git reset --hard A
and make a commit on top of it that gets me to working state in commit B
. However, I can't figure out a way to add a commit that is the diff between A
and B
.
Does anyone have an idea for how I can make this commit, essentially removing all of the stuff from my branch that I wanted to separate out?