I am working on a repo from the original base A, to current HEAD (stashed B). In the meanwhile, the remote upstream was updated from A to C. I would like to rebase my local to C and stash B on top of that:
Remote: A -> C ---
---^
|
Local: A -> B
What I did was:
git stash push # Save my current HEAD B in stash
git fetch remote
git reset --hard remote/main # This set my current HEAD to remote C
git stash pop # Merge B into C
However after stash popped, new changes from remote C is missing and deleted during the stash merge. How do I do this properly? Should I do a rebase instead of reset, regular pull, merge, pull rebase, cherry-pick the stash commit, etc.?