1

I have two branches of my project: master and live. I made some changes to my local files and when i was done, i wanted to push the changes to master. I never knew the current branch on git was live. I ran:

git add .
git commit -m "integrated ckeditor to replace Froalaeditor"
git pull --rebase bonychicken master

It was at this point git spat out:

From github.com:Lord-sarcastic/bonychicken
 * branch            master     -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: changed debug to false
Applying: integrated ckeditor to replace Froalaeditor.

And then I lost all changes to my local files.

So far i've tried

git reflog master
git reset --hard HEAD@{0}

It doesn't work. Neither does git rebase --abort

Lord_Sarcastic
  • 197
  • 2
  • 10

1 Answers1

0

I never knew the current branch on git was live

In your case, git reflog live, since you seem to have committed on the branch named live.

Then you can read the commit SHA1 you just created, and reset --hard your live branch to said commit.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Just tried it, It displayed: `HEAD is now at 1ed1449 integrated ckeditor to replace Froalaeditor.` But my lost changes has not been restored. – Lord_Sarcastic Feb 01 '20 at 20:38
  • It should display a list, including the commit before head was moved. – VonC Feb 01 '20 at 21:41