Tell me, please solve the problem:
There are two branches: Sphere
and Tags
.
I was in a branch Sphere
and accidentally made Git Pull Origin Tags
, then, noticing that he wrote wrong, and without looking at that Merj went with conflicts, made Git Pull Origin Sphere
, and all new changes from Sphere
were joined in the branch.
How can I return the code to the state to the first Pull
?
Answer 1, Authority 100%
Git Reset --hard
Git Checkout Sphere.
Git Reflog.
# Find the hash committees in which you were before the first pull-a.
# There will be something like "8F05E00 Head @ {4}: Checkout: moving from Master to Sphere"
# or "4C31200 Head @ {10}: Commit: Awesome Feature Implemented."
Git Reset --hard [Need Hash]
Well, I would not recommend using “Git Pull” at all, because this team takes too many functions and its behavior is not obvious. I recommend to figure out in more detail how Git works, and use Fetch + Merge or Fetch + Rebase. I personally prefer the second, but this is a matter of taste.