-
Recent Posts
Recent Comments
- Mac OS X color showing ESC[whatever for git-diff colors (and more) (12)
- Gopala Krishna A: Thanks a lot!! This really proved helpful on opensuse 11.2
- Silly Avatar: Thanx for this blog entry. Was having this problem while ssh-ing to a linux vps w/Putty. Thought it was...
- Girish KS: Thanks for the post Nate and thanks pablitostar for your suggestion. I started using git few days back and...
- pablitostar: I found using the -r flag did fix git-diff, but it broke something else in less. Specifically, searching...
- Gopala Krishna A: Thanks a lot!! This really proved helpful on opensuse 11.2
- ActiveRecord from_xml (and from_json) part 2 (3)
- Billy Kimble: Thanks for the snippet of code — it has helped me out tremendously. Unfortunately it did not work...
- Mac OS X color showing ESC[whatever for git-diff colors (and more) (12)
Categories
- bookmarks (2)
- cascading (2)
- code (2)
- deployment (6)
- ec2 (3)
- erlang (2)
- gems (3)
- git (7)
- hadoop (3)
- java (1)
- merb (1)
- music (1)
- osx (2)
- poolparty (3)
- processing (1)
- programming (43)
- rails (11)
- ruby (21)
- scalability (5)
- shell (8)
- sysadmin (16)
- tips (13)
- Uncategorized (3)
- useless (1)
Archives
Pages
Blogroll

temporarily undo commit(s) on a remote server
I do not claim to be a wiz at git, and I do not ensure what I am writing about, but it seemed to work for me, and I appreciate any comments.
My goal was to temporarily revert one or many commits that I had pushed to the remote server.
http://cheat.errtheblog.com/s/git — specifically the “Fix mistakes / Undo” section was helpful.
What I found:
#run this for each commit you would like to “undo”
(the -n makes it so that you are not actually creating a commit, but staging the reverse of the changes made by your <sha> commit in your index. git status will show you this)
now your index looks like:
now, lets say, the time has come to reapply your commits. Because you didn’t just do
or something like that, all you have to do is git reset –hard <sha1> which will “undo your undo”
then
git push #origin masteragain and you are back to where you were.