git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ittay Dror <ittayd@tikalk.com>
Cc: git@vger.kernel.org
Subject: Re: how do i revert to a previous version, keeping the history
Date: Wed, 02 Apr 2008 00:12:52 -0700	[thread overview]
Message-ID: <7vfxu4afwr.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <47F32CBE.2040305@tikalk.com> (Ittay Dror's message of "Wed, 02 Apr 2008 09:50:38 +0300")

Ittay Dror <ittayd@tikalk.com> writes:

> I have this revision history: A-B
> I want to go back to the code in A, but keep B in the history: A-B-A
>
> How do I do that?

Straight answer (iow, what you asked, which may not match what you wanted
to really do):

	$ git read-tree -m -u A
        $ git commit -m 'Revert to A'

Probably a more useful answer, guessing what you really wanted to do:

You have a botched commit F that was in the sequence of longer commits,
A--B--C--D--E--F--G--H, and you want to recover from the mistake F made
(iow, the change between E and F is bad):

	$ git revert F

This will make your history A--B--C--D--E--F--G--H--F' where the
difference between H and F' counteracts what F did relative to E.

      parent reply	other threads:[~2008-04-02  7:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02  6:50 how do i revert to a previous version, keeping the history Ittay Dror
2008-04-02  6:57 ` Johannes Sixt
2008-04-02  7:12 ` Junio C Hamano [this message]

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=7vfxu4afwr.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=ittayd@tikalk.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).