1

I've cloned some project from github, to my project, all works good, I'm happy.

But after some git pulls I receive some conflicts in my project with new commits of upstream project.

I want to rollback to previous checkout, but i don't know which stable checkout was previous in my project.

How I can know it and rollback to previous stable (for me) project checkout? I understand that in perspective more correct way to fix my conflicts with upstream repo, but sometimes i just need rollback to previous version, to get time for fixing problem.

CharlesB
  • 86,532
  • 28
  • 194
  • 218
user1081056
  • 533
  • 2
  • 4
  • 15
  • it's not clear to me if you know how to checkout a previous version? If not see http://stackoverflow.com/q/1223354/11343. – CharlesB Apr 23 '12 at 07:08

3 Answers3

2

If you have a command/script you can execute and which would illustrate a "stable point" (ie something working, as opposed to the current state where it is not working), then you can consider a git bisect command.
See "How to use git bisect?".

That would help you isolate the last commit where "it was working".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

git reflog should tell you the order of operations, most recent first. Look for the commit ID that was operated on before your first pull/merge; checkout or reset --hard to that.

Asherah
  • 18,948
  • 5
  • 53
  • 72
0

Have you already commited the merge? If not, just git reset --hard and you're back to the state before you issued git pull. Otherwise, git reset --hard HEAD^ (if the merge was the last commit) does the trick, since git will by default always pick the first parent of a merge commit, which is your branch. If in doubt, you can always use e.g. gitk to inspect the situation and find the last commit on your branch, copy its SHA1 hash and revert to that.

Michael Wild
  • 24,977
  • 3
  • 43
  • 43