When I want to split up a new file into several commits I can git add -N
and then interactively stage lines using git gui
. When I make a m
I just ran into the same issue: I had just committed a new file, and I wanted to unstage some of the lines in that file and have those as a separate commit. The solution I worked out was:
git commit -m 'REVERTME'
git revert HEAD
git rebase -i
to fixup
the first new commit, and optionally reword
the revert commit.