I have some branch name X
I was working on. I committed my work locally (didn't push).
Then I noticed a bug and tried to compare my results to the ones in the remote.
I tried to checkout (through pycharm
) to my remote branch. It says there are diffs and I should rebase, or override. I clicked override, thinking that rebase will push my changes, but I actually override my work on the local machine!
Is there anything I can do? I tried to look through git log
and couldn't find a commit that has my work.
Even though I did commit my work before trying to checkout.
Thanks
EDIT: This was resolved (thanks god) using ctrl z (and doing undo reload from disk). I leave this still open since I don't have a clue what happen, so an explanation might help me or others in the future.
CodePudding user response:
You should do:
git reflog
# Search for your lost commit, and write down its hash code, then...
git checkout <LOST_COMMIT_HASH>