Reputation: 1207
I am on branch "master". I had such git history:
333 (#82)
444 (#83)
Then I done some commits and reverts (222->111->010->789->456->123):
123 Revert "(#84)"
456 Revert "(#81)"
789 Revert “(#81)"
010 Revert "(#86)"
111 (#86)
222 (#84)
333 (#82)
444 (#83)
I need somehow to clear those wrong steps (222->111->010->789->456->123) to return history back to :
333 (#82)
444 (#83)
will it be ok if i do:
git rebase -i 333
and will drop wrong commits? then
git push -f
Upvotes: 0
Views: 72
Reputation: 1323
Assuming you haven't pushed the commits and reverts, do the following:
git reflog
This will give you a list of ops (incl. all reverts and commits) in reverse chronological order. Find the last stable commit and find its head in the form of HEAD@{somenumber}
. Then to fall back to that commit, do the following:
git reset --hard HEAD@{somenumber}
Upvotes: 1