git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geoffrey Lee <geoffreyj.lee@gmail.com>
To: git@vger.kernel.org
Subject: How to create patches for a merge?
Date: Thu, 18 Feb 2010 03:40:07 -0800	[thread overview]
Message-ID: <83d7aaa41002180340p2f9b7241h9c220b84ec5dd1d@mail.gmail.com> (raw)

When I use "git format-patch", it doesn't seem to include merges. How
can I perform a merge and then e-mail it to someone as a set of
patches?

For example, let's say that I merge two branches and perform another
commit on top of the merge:

git init

echo "initial file" > test.txt
git add test.txt
git commit -m "Commit A"

git checkout -b foo master
echo "foo" > test.txt
git commit -a -m "Commit B"

git checkout -b bar master
echo "bar" > test.txt
git commit -a -m "Commit C"

git merge foo
echo "foobar" > test.txt
git commit -a -m "Commit M"

echo "2nd line" >> test.txt
git commit -a -m "Commit D"

This creates the following tree:

    B
  /   \
A       M - D
  \   /
    C

Now I try to checkout the initial commit and replay the above changes:

git checkout -b replay master
git format-patch --stdout master..bar | git am -3

This produces a merge conflict. In this scenario, "git format-patch
master..bar" only produces 3 patches, omitting "Commit M". How do I
deal with this?

-Geoffrey Lee

             reply	other threads:[~2010-02-18 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18 11:40 Geoffrey Lee [this message]
2010-02-18 18:10 ` How to create patches for a merge? Junio C Hamano
2010-02-18 20:37 ` Jeff King
2010-02-19 10:25   ` Geoffrey Lee
2010-02-20 17:39     ` Clemens Buchacher

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=83d7aaa41002180340p2f9b7241h9c220b84ec5dd1d@mail.gmail.com \
    --to=geoffreyj.lee@gmail.com \
    --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).