the original commit contained 5 files:
a.txt
b.txt
c.txt
d.txt
e.txt
the next commit adds lines to the bottom of a.txt
, deletes b.txt
and uploads a new file f.txt
. i.e.
a.txt - additions from second commit
c.txt
d.txt
e.txt
f.txt - new file from second commit
I would like to merge the commits, so that I accept changes a.txt
, restore b.txt
from the first commit and add f.txt
from the latest commit. The repo should now look like:
a.txt - additions from second commit
b.txt - restored from first commit
c.txt
d.txt
e.txt
f.txt - new file from second commit
I tried doing this with git rebase --root -i
and left the original commit as "pick" and changed the second commit to "squash"
i.e.
pick commit1
squash commit2
but after rebase completes, I left with only commit2
Have I done something wrong, or is what I am asking not possible?