I have a remote Git repository, and I need to roll back the last n commits into cold oblivion.
I have a remote Git repository, and I need to roll back the last
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use
git revert <commit>…for all the n commits, and then push as usual, keeping history unchanged.Or you can ‘roll back’ with
git reset --hard HEAD~n. If you are pushing in a public or shared repository, you may diverge and break others work based on your original branch. Git will prevent you doing so, but you can usegit push -fto force the update.