2

I'm working through the Rspec book and forgot to fork the sample repository before I started working. I looked up how to fix that and followed the directions in forgot to do a fork on GitHub before starting my work. However, in the process I undid all of my environment setups and now I'm getting a bunch of errors about nokogiri.

I've dealt with old versions of nokogiri before and troubleshooting that can take forever, so I want to just go back to where I was. Problem is "git log" only tells me about the git history of the repository I forked, not the work I did over the past few days.

I'm sure it's here somewhere, since git never forgets anything but I don't know how to find it. Help!

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • that helps (git reflog, in particular) but it's still not working the way it did before. Still, at least it's not nokogiri, so I've made a new branch from the commit that was working and I'm going to see if fiddling with the database fixes this. – a.light.holder Jan 13 '16 at 21:14
  • nope, not the database, but the work I started. Once I commented that out, I was back to where I was before. Thanks! – a.light.holder Jan 13 '16 at 21:23

1 Answers1

1

Go to the original repo and get the SHA of it's master branch (assuming this is where you forked).

Let's say that this sha is ABCDE.

Before we make changes, make sure you have a clean working directory and index, so commit if needed and then run git status to make sure everything is clean.

Now, let's re-work your repo so it's clear when you forked:

git branch myFork
git checkout master
git reset --hard ABCDE
git checkout myFork

Now, you can compare your myFork branch to master to see the differences. For example you could do:

git diff master..myFork

As you work, it's a very good idea to commit frequently, whenever you reach a somewhat stable point. This way you can keep track of little milestones and revert if you get stuck.

Don't worry about committing too much...you can always squash commits together before pushing them to a public repository.

Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115