I was working on the wrong branch called wrong_branch
and I committed and tried to push my new files to this wrong branch. However, I got an error: current wrong_branch branchhas no upstream branch
- that's when I realised that I was on the wrong branch.
Then I made a number of mistakes:
- I tried to checkout the branch I should be working on called
should_be_branch
. Realised my new files weren't there obviously - Then, I checked out
wrong_branch
to see my new files. - Then I tried to use the trick:
git stash
>git checkout should_be_branch
>git stash apply
. However, the new files did not get copied over toshould_be_branch
- Then I tried to check out
wrong_branch
but I am getting an error:example_file.py: needs mergeerror: you need to resolve your current index first
I am afraid if I do anything more that I will lose my new files.
Can you please help me retrieve them?