From: Linus Torvalds <torvalds@linux-foundation.org>
To: Alan <alan@clueserver.org>
Cc: git@vger.kernel.org
Subject: Re: Odd merge behaviour involving reverts
Date: Thu, 18 Dec 2008 16:46:51 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0812181637140.14014@localhost.localdomain> (raw)
In-Reply-To: <1229646948.5770.33.camel@rotwang.fnordora.org>
On Thu, 18 Dec 2008, Alan wrote:
>
> So what is the recommended way to undo mistaken merges caught after the
> fact that will not fubar later merges?
Oh, I suspect reverting is the right thing, it's just that then you need
to remember to revert the revert if you intend to merge that branch again
later.
So reverting a merge isn't _wrong_ per se. It's just that you need to be
aware of the consequences, and if it becomes a common situation, you have
a problem in your usage patterns.
Btw, even with non-merge commits, "revert" can have interesting effects
exactly because it doesn't change history. For example, let's say that you
had a history like this, with two branches:
--> a --> b --> c --> d
|
+-> e --> !a
where the second branch reverts 'a', but the first one does not. What
happens when you merge the two branches? Is the revert sticky? In this
case, yes, a merge will cause the revert to stick. But what happens if you
had
--> a --> b --> c --> d
|
+-> e --> f --> !e
and 'b' and 'e' were the same patch (just applied in two different
branches), and '!e' reverts that patch in the second branch. What happens
to 'b' when you merge? Would you expect for 'b' to go away, since the
revert undid the same data in the second branch?
In that second case, the revert of 'e' will basically make git act as if
'e' didn't happen at all in the second branch, and so when you merge them,
'b' _will_ exist in the end result, so now the revert didn't "take".
All of this is very self-consistent (it's a very direct result of how
merges work and how revert works), but I'm just bringing these things up
as examples of how 'revert' is not a totally trivial matter. You'll always
find cases where you might have wished that it had acted differently when
you merge things.
Linus
next prev parent reply other threads:[~2008-12-19 0:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-18 23:25 Odd merge behaviour involving reverts Alan
2008-12-18 23:58 ` Linus Torvalds
2008-12-19 0:11 ` Alan
2008-12-19 0:21 ` Linus Torvalds
2008-12-19 0:35 ` Alan
2008-12-19 0:46 ` Linus Torvalds [this message]
2008-12-19 1:30 ` Boyd Stephen Smith Jr.
2008-12-19 3:44 ` Nanako Shiraishi
2008-12-19 4:01 ` Linus Torvalds
2008-12-19 4:18 ` Jay Soffian
2008-12-19 4:23 ` Linus Torvalds
2008-12-19 5:24 ` Daniel Barkalow
2008-12-19 8:45 ` Junio C Hamano
2008-12-19 21:45 ` Nanako Shiraishi
2008-12-19 23:05 ` Junio C Hamano
2008-12-19 23:12 ` Nanako Shiraishi
2008-12-19 23:51 ` 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=alpine.LFD.2.00.0812181637140.14014@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=alan@clueserver.org \
--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).