L
L
liltrill2019-11-03 17:45:50
git
liltrill, 2019-11-03 17:45:50

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

1 answer(s)
E
Evgeny Samsonov, 2019-11-03
@liltrill

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 question

Ask a Question

731 491 924 answers to any question