I wanted to check if my new changes to code were compatible with existing database, thus I tried to create a new branch from HEAD
of remote ORIGIN
.
I ran exactly the following code :
git checkout -b test origin/master
Till this time, my modified code was present in new branch. I know this because I saw similar output
M filename1
M filename2
M filename3
M filename4
I wanted to roll back changes, to the previously pushed commit, hence ran this command
git reset --hard HEAD
Running this command, reversed all the changes. I thought that happened only for this branch, but I was wrong. I did some changes to code in this branch (I edited only one file which was earlier modified in master branch)
I think this was where all went wrong, I checked out master branch using
git checkout master
I see output similar to following
M filename1
M filename2
This is where I realise all changes were lost. I have tried resetting the HEAD again but no progress.
Is there any way to recover those files, or I have to write all code again?