Git revert a commit
To revert a very simple commit, this is enough:
git revert ba24a3fdeae4a3a034691308171d798d2ddbf93e
Where that long string of characters is the ID of the commit you are reverting.
For a more careful approach to a complex revert, read on...
(if things go horribly wrong we can throw out this branch-- note we may have to commit everything in the branch in order to switch to another branch and delete this one with git branch -D revert-alpha-6
This approach worked:
Based in part on http://www-cs-students.stanford.edu/~blynn/gitmagic/ch02.html#_reverting
Note: "git revert" makes a commit with the revert for us.
To tell us what we want to revert, we use git log:
git log
Completion of upgrade to Drupal 7 Alpha 6 required a custom module, do it fi
commit 66d296bd6aaf09031329348db22e283d77476747
Author: Benjamin Melançon ben@agaric.com
Date: Sun Jul 11 09:24:02 2010 -0700
Upgrade to Drupal 7 alpha 6 using a diff method.
git checkout -b revert-alpha-6 master
git revert e93d009d4ae28006c4dadc3ad594c83c23c75c10
git revert 66d296bd6aaf09031329348db22e283d77476747
git checkout master
Switched to branch 'master'
git merge revert-alpha-6
(see a bunch of content go by, and make sure everything is set by checking that git diff master..revert-alpha-6
returns nothing).
This approach failed when i tried to do two reverts in a row
But i stole other elements of the branching and committing process around doing the revert from this tutorial.
From http://www.kernel.org/pub/software/scm/git/docs/howto/revert-branch-rebase.html
git show-branch --more=4 master master^2 | head
! [master^2] added my dgd7 bartik subtheme
- [master] Merge branch 'master' of git.agaric.com:/srv/git/dgd7
++ [master^2] added my dgd7 bartik subtheme - [master^] Git ignore that ignores some devel modules too.
- [master~2] Completion of upgrade to Drupal 7 Alpha 6 required a custom module, do it first next time. See http://data.agaric.com/raw/upgrading-from-drupal-7-alpha-drupal-7-alpha
- [master~3] Upgrade to Drupal 7 alpha 6 using a diff method.
++ [master~4] My patch to fix insert module based on object to entity name change figured out by original poster.
Comments
Post new comment