Answer the question
In order to leave comments, you need to log in
How to reset a git repository to the Nth commit?
There is a bare repository where everything goes, and a repository that is a working copy of the bare repository (via git clone).
Tell me how to reset the state of both repositories to an arbitrary (Nth) commit?
As far as I understand, you must first reset the bare repository, and then just update the working copy via git pull, right?
Answer the question
In order to leave comments, you need to log in
No, you need to reset the local one with git reset --hard hash_commit , and then bare it with git push -f . But it is not recommended to edit commits that were sent to the origin. The rest of the people who work with you will have to do git fetch && git reset --hard origin/branch_name and if someone does not do this, then when pushing, he will return those commits that you deleted, but he still had them locally.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question