Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to back out certain pushes

Tags:

git

git-revert

I'm looking at the last 10 or so pushes, and I would like to back out 4 of them (unconsecutive).

How can I do this?

In SVN, it would be a matter of reverting the changes and pushing the "undone" changes back in. Not sure how to do it in Git.

like image 343
amit Avatar asked Dec 21 '22 12:12

amit


1 Answers

You use git revert <commit> to revert the offending commits without rewriting history. This creates a new commit that undoes these commits.

Instead of <commit> you use the SHA of each commit you want to revert.

like image 156
ThiefMaster Avatar answered Jan 03 '23 01:01

ThiefMaster