Home git How to cancel (roll back) action Git Pull?

How to cancel (roll back) action Git Pull?

Author

Date

Category

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.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions