git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Robert Buck <buck.robert.j@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "git@vger.kernel.org List" <git@vger.kernel.org>
Subject: Re: got myself into trouble; now what? - how to revert once you've pushed
Date: Wed, 2 Mar 2011 08:10:38 -0500	[thread overview]
Message-ID: <AANLkTi==_zmSy4j-JwyCuYouV-J3shSObJe2y942PjCn@mail.gmail.com> (raw)
In-Reply-To: <20110301195027.GE10082@sigill.intra.peff.net>

On Tue, Mar 1, 2011 at 2:50 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Mar 01, 2011 at 02:37:19PM -0500, Robert Buck wrote:
>
>> We have two branches: master, feature/wixinstall
>>
>> Apparently a merge happened from the branch to master (and I am pretty
>> sure I never typed `git merge...`). But alas, a merge somehow happened
>> and got pushed.
>
> Did you run "git pull", which is basically fetch+merge?
>
>> Then I followed the Git Pro documentation, which said to do this...
>>
>>     git revert -m 1 [sha_of_C8]
>>
>> Now I am left with a bigger mess. When I merge master to the branch,
>> all the newly added files on the branch got deleted (not what I
>> wanted). Somehow git is interpreting the revert literally as a
>> sequence of deletes which it incorrectly then applies to the work on
>> the branch.
>
> Yeah. That reverts the merge, in essence creating a new tree built on
> top of the merge without the results of the merge. But when you try to
> re-merge between those two branches, it sees that history has already
> combined, and then afterwards eliminated the result. Which is not what
> you wanted.
>
> Read the section "reverting the revert" directly below the advice you
> followed:
>
>  http://progit.org/2010/03/02/undoing-merges.html
>
>> What I really wanted the revert to do is restore the history of the
>> world immediately prior to the merge. But now I have a branch I can't
>> merge into at all without losing a weeks work.
>>
>> How can I get out of this mess?
>
> If you can accept that history will be rewritten (which is a problem if
> people have built on top of your bogus merge), then what you want is:
>
>  git checkout master
>  git reset --hard $SHA1_OF_MERGE^
>
> and then re-push.

That does not work; the central server rejects the commit. Now there
are two other commits after mine, and the problem is getting worse.

Does anyone have a detailed guide of how to obliterate a range of
commits and replay subsequent history on top of that?

-Bob

  reply	other threads:[~2011-03-02 13:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-01 19:37 got myself into trouble; now what? - how to revert once you've pushed Robert Buck
2011-03-01 19:50 ` Jeff King
2011-03-02 13:10   ` Robert Buck [this message]
2011-03-02 13:37     ` Jeff King
2011-03-02 15:52       ` Jon Seymour

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='AANLkTi==_zmSy4j-JwyCuYouV-J3shSObJe2y942PjCn@mail.gmail.com' \
    --to=buck.robert.j@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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).