Reputation: 533
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.
Upvotes: 1
Views: 421
Reputation: 19347
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.
Upvotes: 1
Reputation: 26341
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.
Upvotes: 0
Reputation: 1324278
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".
Upvotes: 2