I was working on a branch and by accident I've done git reset HEAD~1
because I thought I'm resetting my last commit.
The problem is that I didn't even commit my changes so I've done reset to commit which was done by someone else. A lot of changes in that commit were done on files on which I was also working on so I didn't notice and continued my work. After I've committed and pushed my changes, I've noticed missing commit.
develop branch: commitA -> commitB -> commitC
my branch: commitA -> commitB -> myCommit
Is there any way to revert those changes and insert commitC
before my commit?
You can see your working tree by
git reflog
. First, back tocommitC
and pick yourmyCommit
top ofgit log
stack. Then just update remote.