From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: martin f krafft <madduck@madduck.net>,
git discussion list <git@vger.kernel.org>
Subject: Re: unmerging feature branches
Date: Tue, 23 Oct 2007 12:33:29 -0700 [thread overview]
Message-ID: <7vir4x7hiu.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.0.999.0710230922240.30120@woody.linux-foundation.org> (Linus Torvalds's message of "Tue, 23 Oct 2007 09:50:59 -0700 (PDT)")
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Now, that said, reverting the data is not that hard. There is not any
> single-command "revert this arm of a merge", but on the other hand, git
> can certainly help you.
>
> The way to do it is:
>
> # go back to just before the merge, create a "fixup" branch
> #
> git branch -b fixup M^
>
> # merge all of it again, *except* the branch you didn't want to
> # merge (this example assumes that you had a four-way octopus
> # merge, and you now want to turn it into a three-way with the
> # next-to-last parent skipped):
> ...
Desire to revert an octopus would, as you demonstrated, often be
to revert only one arm, but I think allowing to revert a twohead
merge should be trivial. If we define "reverting a merge" to
always revert all arms, then this should suffice.
diff --git a/builtin-revert.c b/builtin-revert.c
index a655c8e..719e293 100644
--- a/builtin-revert.c
+++ b/builtin-revert.c
@@ -269,8 +269,8 @@ static int revert_or_cherry_pick(int argc, const char **argv)
if (!commit->parents)
die ("Cannot %s a root commit", me);
- if (commit->parents->next)
- die ("Cannot %s a multi-parent commit.", me);
+ if (action != REVERT && commit->parents->next)
+ die ("Cannot %s a merge commit.", me);
if (!(message = commit->buffer))
die ("Cannot get commit message for %s",
sha1_to_hex(commit->object.sha1));
Note that allowing cherry-pick by removing the above two lines
allow replaying the data of a merge similar to a squash merge.
next prev parent reply other threads:[~2007-10-23 19:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-23 15:24 unmerging feature branches martin f krafft
2007-10-23 16:19 ` Matthieu Moy
2007-10-23 16:50 ` Linus Torvalds
2007-10-23 17:16 ` martin f krafft
2007-10-23 17:40 ` Linus Torvalds
2007-10-23 18:08 ` martin f krafft
2007-10-23 18:24 ` Linus Torvalds
2007-10-23 19:17 ` martin f krafft
2007-10-23 19:38 ` Linus Torvalds
2007-10-23 19:46 ` Linus Torvalds
2007-10-31 21:16 ` Alejandro Martinez Ruiz
2007-10-31 21:27 ` martin f krafft
2007-10-31 21:34 ` Linus Torvalds
2007-10-23 19:33 ` Junio C Hamano [this message]
2007-10-23 19:49 ` Linus Torvalds
2007-10-23 20:33 ` [PATCH] revert/cherry-pick: work on merge commits as well 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=7vir4x7hiu.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=madduck@madduck.net \
--cc=torvalds@linux-foundation.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).