A
A
ATauenis2020-05-21 23:57:42
git
ATauenis, 2020-05-21 23:57:42

How to return to the state in git as on the server?

Sometimes it happens that I get confused in the park in the branches of the Git repository with all sorts of merge, rebase, cherry-pick, checkout, etc.. Fortunately, this happens before I push all this nonsense to the server. But the local copy by that time was completely corrupted.

How to reset everything that you have done to the state of stupidly like on the server? You can just delete everything and re-clone the repository. But this is not for sports, plus all sorts of files from gitignore are lost, which at the same time must be saved by hand. We need a more civilized method, but just as effective in terms of forgetting all unsent changes.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stepan Krapivin, 2020-05-22
@ATauenis

git checkout master -f

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question