@xcombinator
- I realize there are a million already, but I created another git cheatsheet: http://bit.ly/bfAKlZ 2010/09/01
-
Recent Posts
Recent Comments
- ActiveRecord from_json and from_xml (5)
- Terence: Dude, you are the bomb. Thanks for your fix. Helped us out heaps.
- djb daemontools with Ubuntu’s upstart (2)
- sorcess: such config may lead to data loss… consider above configuration with this little change start on...
- Mac OS X color showing ESC[whatever for git-diff colors (and more) (15)
- automate installing tripwire using expect (1)
- Trey Henefield: I came across this as useful. But I found an even easier solution. There is an option that disables...
- ActiveRecord from_json and from_xml (5)
Categories
- bookmarks (2)
- cascading (2)
- code (2)
- crawling (1)
- 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 (48)
- 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.