I seem to have lost a few files worth of edits, so I'm trying to figure out what I did wrong. It certainly seems like a git merge affected both the source and target branches. I'm not worried about finding the lost edits, just fixing my understanding of git.
I have a develop branch. I created a feature-x branch, did some work, and made a single commit affecting 8 files (call that commit "WIP"). Then I switched back to develop, did some other work on other features (since merged), and today I needed to get a some pieces from feature-x into develop:
git checkout develop
git merge feature-x --no-commit --no-ff
So now develop has my feature-x changes on top, uncommitted/unstaged. I staged and committed two of the files (call that commit "Two Files"), but decided I wasn't ready to commit the rest to develop. I wanted to leave them in feature-x, but figured it was worth rebasing feature-x onto the current develop branch. At this point, I thought feature-x should still be unchanged - the merge should have only changed develop. So I cleaned up the uncommitted changes from the merge:
git reset --hard HEAD; git clean -f -d
And tried to rebase feature-x onto develop:
git checkout feature-x
git rebase develop
I expected my history now to show all my older develop commits, then the new "Two Files" commit, and then the "WIP" commit from feature-x rebased on top. But all I see is "Two Files"... the changes from the "WIP" commit seem to be gone.
So where did I go wrong? I forgot to check the commit log after checking out feature-x right before the rebase, but I have to assume the "WIP" commit was already gone since it was gone after the rebase. Did the merge --no-commit --no-ff onto develop also change feature-x?