git move partial changes across commits - MarekBykowski/readme GitHub Wiki
Say you have file1
changed in a few last commits.
If you want to merge the changes into one commit you have to:
git log -p -- file1
-
git rebase -i <SHA1-1>
to include theSHA1
of interest - mark the
SHA1
having the change on thefile1
e
- git will stop rebasing on the
SHA1
git reset HEAD~1
git add file1; git commit -s file1
- then repeat for the other files, spliting it into as many commits as wanted
You end up here with a separate commit on a file1
and the remaining. Break down is done
git rebase --continue
- then see the history, rebase and squash the changes on a
file1
to have one commit