Read more

Git: "Interactive reverts"

Tobias Kraze
November 11, 2010Software engineer at makandra GmbH

If you need to revert only parts of one or several commits the following workflow can help:

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

If you need to revert multiple changes, make a branch and squash it afterwards.

For every commit you need to revert, starting at the most recent, do:

git revert -n [COMMIT] #revert, but don't automatically commit
... #fix any conflicts
git reset #unstage all changes
git add -p #this will ask you for every change, whether you want to go through with the revert (i.e. "y" will revert, "n" will not; "?" for help)
git commit
git reset --hard #throw away all changes you did not want to revert
Posted by Tobias Kraze to makandra dev (2010-11-11 10:40)