git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jon Smirl" <jonsmirl@gmail.com>
Cc: "Git Mailing List" <git@vger.kernel.org>
Subject: Re: Rollback of git commands
Date: Tue, 27 Nov 2007 16:51:59 -0800	[thread overview]
Message-ID: <7vmyszb39s.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <9e4733910711271523p3be94010jac9c79e6b95f010d@mail.gmail.com> (Jon Smirl's message of "Tue, 27 Nov 2007 18:23:35 -0500")

"Jon Smirl" <jonsmirl@gmail.com> writes:

> Could a rollback log be implemented in git? It would make things way
> easier when you screw something up. You'd only roll back things that
> impacted the object store, not things like checkout.

The object store is append only, and if you disregard SHA-1 collisions,
I do not think there is much you can gain from being able to roll back
only object store.

For example, you would want to be able to roll back where your 'master'
branch was pointing at before you started that botched operation.  That
is not in the object store at all (we have reflogs for that).

Another example, you might have done quite an elaborate interactive add
to stage only some changes to a path, but then accidentally said "git
add" that path to stage the whole thing.  You may say "oops, that state
was only in the index and now it is lost."  The blob that records the
staged content _DOES_ exist in the object store in such a case so it is
not lost --- there is nothing to roll back.  What you lost is a pointer
into the object store (we do not have anything like reflog for
individual index entry --- not that I would suggest adding one).

Creating a blob that records all of .git/config, output from
for-each-ref, output from "symbolic-ref HEAD" and output from ls-files
-s every time you run _any_ git operation, and restore the state when
you want to, would conceptually work, as you suggest, but I am not sure
how practical it would be, performancewise, spacewise, and
semanticswise.

  reply	other threads:[~2007-11-28  0:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 23:23 Rollback of git commands Jon Smirl
2007-11-28  0:51 ` Junio C Hamano [this message]
2007-11-28  1:33   ` Jon Smirl
2007-11-28  1:49     ` Jon Smirl
2007-11-28  1:57       ` David Symonds
2007-11-28 16:50         ` Ingo Molnar
2007-11-28 18:39           ` Sergei Organov
2007-11-28 18:52             ` Nicolas Pitre
2007-11-28  4:07       ` Geert Bosch
2007-11-28 16:20         ` Jeff King
2007-11-28 16:23           ` Jon Smirl
2007-11-28 16:28             ` Jeff King
2007-11-28  3:55     ` Sean
2007-11-28  4:37       ` Jon Smirl
2007-11-28  4:40         ` Sean
2007-11-28  4:53           ` Jon Smirl
2007-11-28 14:53         ` Nicolas Pitre
2007-11-28 15:58           ` Jon Smirl
2007-11-28 16:26             ` Nicolas Pitre
2007-11-28 16:37               ` Jon Smirl
2007-11-28 16:46                 ` Nicolas Pitre
2007-11-28 17:03                   ` Jon Smirl
2007-11-29  8:42               ` Karl Hasselström
2007-11-28  4:57       ` Junio C Hamano
2007-11-28  9:22     ` Karl Hasselström
2007-11-28 15:13       ` Jon Smirl
2007-11-28 21:47         ` Daniel Barkalow
2007-11-28 21:58           ` Steven Grimm
2007-11-28 22:48             ` Daniel Barkalow
2007-11-28 23:42           ` Jon Smirl
2007-11-29  8:28             ` Theodore Tso

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=7vmyszb39s.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jonsmirl@gmail.com \
    /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).