git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Jensen <jjensen@workspacewhiz.com>
To: git@vger.kernel.org
Subject: Reverting an uncommitted revert
Date: Tue, 19 May 2009 20:34:40 -0600	[thread overview]
Message-ID: <4A136C40.6020808@workspacewhiz.com> (raw)

I had an interesting experience the other day I'd like to share.  It is 
a story of my stupidity plus a bug in the latest version of the Mac OS X 
'git gui'.

I had spent several evenings working on a piece of source code.  It was 
basically working, but I hadn't committed anything yet. Yes, I know I 
should have made a branch and performed incremental commits, but I 
didn't.  This is why I was stupid.

Because of a busy week, it was many days before I could get back to what 
I was working on.  By then, I had forgotten what I was doing, and so I 
pulled up the handy 'git gui' to show me my diffs.

'git gui' showed me a single whitespace change in the diff.  The scroll 
bar extended from top to bottom in the diff window and wouldn't move.  
(This is the bug, which is easily reproducible.)  I thought, "Gee, 
that's weird.  I thought I'd made more changes."  Not wanting the silly 
whitespace change, I chose Commit->Revert Changes from the menu.

A couple hours later, I was pulling my hair out trying to find the 
change that I knew, deep down, I had reverted.

I also knew there was no support for putting a reverted change in the 
reflog, but hey, the reflog has saved me before.  I looked.  It wasn't 
there.

So here's the idea: What if Git, upon a revert change (or git reset 
--hard HEAD), "committed" the changes to be reverted and then did the 
revert with a 'git reset --hard HEAD^'?  The reverted files would be 
disconnected from a branch, but they would be available in the reflog to 
retrieve.

Or do I just not 'get it'?

Thanks!

Josh

             reply	other threads:[~2009-05-20  2:41 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20  2:34 Joshua Jensen [this message]
2009-05-20  3:10 ` Reverting an uncommitted revert Nicolas Pitre
2009-05-20  3:21   ` Jeff King
2009-05-20  3:35     ` Nicolas Pitre
2009-05-20  3:38       ` Jeff King
2009-05-20  4:58       ` Ping Yin
2009-05-20  9:15       ` Wincent Colaiuta
2009-05-20 10:16         ` Jakub Narebski
2009-05-20 12:53         ` Nicolas Pitre
2009-05-20 14:17           ` Shawn O. Pearce
2009-05-20 16:55             ` Eric Raible
2009-05-20 17:59             ` Junio C Hamano
2009-05-20 18:19               ` Nicolas Pitre
2009-05-20 18:25                 ` Nicolas Pitre
2009-05-20 18:57                 ` Shawn O. Pearce
2009-05-21  6:16                 ` Junio C Hamano
2009-05-20 18:21               ` Jakub Narebski
2009-05-20 15:23           ` Wincent Colaiuta
2009-05-20 15:47             ` Nicolas Pitre
2009-05-20 16:13               ` Sverre Rabbelier
2009-05-20 16:58                 ` Jeff King
2009-05-20 18:04                   ` Nicolas Pitre
2009-05-20 18:08                     ` Sverre Rabbelier
2009-05-21  3:47                     ` Jeff King
2009-05-20 17:50     ` Junio C Hamano
2009-05-20 18:27       ` [PATCH] write-tree --ignore-cache-tree Junio C Hamano
2009-05-21  0:40         ` [PATCH 1/2] cache-tree.c::cache_tree_find(): simplify inernal API Junio C Hamano
2009-05-21  0:44         ` [PATCH 2/2] Optimize "diff-index --cached" using cache-tree Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A136C40.6020808@workspacewhiz.com \
    --to=jjensen@workspacewhiz.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).