Answer the question
In order to leave comments, you need to log in
How to remove the last 2 commits from a repository in git?
Hello everyone!)
There are two last commits in which there is garbage, and they spoil the whole project. How can I remove them from the repository and return to an adequate commit?)
Answer the question
In order to leave comments, you need to log in
Execute
where <hash>
is the hash of the commit to remove from
Change the pick to drop editor for the commits you want to remove and save the changes. Next, do git push --force this branch to the repository
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question