0

I'll try to explain what I did.

My last commit and push to github was at least a couple weeks ago.

I've still been committing regularly.

Recently, I tried to merge changes, but I wasn't able to because I had changed the readme manually on github and needed to pull it down first.

I tried to pull, but that opened VIM.

I tried to enter a commit message like it was asking but I'm not familiar with VIM and I'm not sure if I was successful or not.

I followed some instructions, but I can't remember exactly what happened. I don't think it was successful because the next thing I decided to do was just force a push.

I had everything I wanted locally, expect for the readme, so I figured it wouldn't be that big a deal.

But after doing that, I decided I should try to go back and save the readme first, duh!

I looked up how to go back to the previous commit and followed the first answer here:

How to recover from a git push -force?

basically this

# work on local master
git checkout master

# reset to the previous state of origin/master, as recorded by reflog
git reset --hard origin/master@{1}

# at this point verify that this is indeed the desired commit.
# (if necessary, use git reflog to find the right one, and
# git reset --hard to that one)

# finally, push the master branch (and only the master branch) to the server
git push -f origin master

Now it looks like instead of being at my previous local commit, I'm at the last commit I pushed to GitHub a couple weeks ago. Is that possible?

Can anyone straighten me out with this? At this point, I'd just like to get back to my previous local commit.

If I loose the readme no big deal.

Here's my git reflog - I'd like to go back to 'fixed a typo'

enter image description here

Louis Sankey
  • 481
  • 8
  • 26

1 Answers1

0

From your reflog, it looks like you just want to do:

git reset 27f3f76

Assuming you don't mind modifying your working directory, you probably want:

git reset --hard 27f3f76  # Caution: will modify working directory
William Pursell
  • 204,365
  • 48
  • 270
  • 300