git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Witten <mfwitten@gmail.com>
To: Sebastian Kuzminsky <seb@highlab.com>
Cc: git@vger.kernel.org
Subject: Re: surprising behavior from merge
Date: Fri, 11 May 2012 23:57:22 -0000	[thread overview]
Message-ID: <ae419d8bbc2b44bfa4c0a7eb421f5037-mfwitten@gmail.com> (raw)
In-Reply-To: <9A9AD20F-B316-4DC1-8C6A-E0FC6ED80A61@highlab.com>

On Fri, 11 May 2012 16:25:29 -0600, Sebastian Kuzminsky wrote:

> Hi folks, I just ran in to a strange behavior with git merge.
>
> Things start out with two branches (let's call them 'master' and
> 'other') pointing at a particular commit. In master I commit a
> small one-line change, then make a second commit that adds some
> stuff just after the line changed in the previous commit. In the
> other branch, i cherry-pick the second commit from master (the
> one that adds the new stuff). The cherry-pick succeeds, despite
> the fuzzy context. So far, so good.
>
> Next I try to merge other into master. I expected it to notice
> there was nothing to do and leave the master tree unchanged,
> but it applied the "add new stuff" patch to master (even though
> that patch is already in master) and made a commit from that. So
> it silently did the wrong thing, and now the file contains two
> copies of stuff I added.
>
> That is a simplified version of what happened, in my real repo
> there were several (unrelated and unimportant) commits on both
> master and the other branch. When the surprising double-add
> happened, i simplified the repo to remove distractions.
> The simplified repo is here if anyone wants to inspect it:
> https://github.com/SebKuzminsky/merge-problem

It would obviously be helpful to supply:

  * Explicit commands that anyone on the list can try and discuss.
    For example:

      git init repo
      cd repo
      echo a  > a; git add a; git commit -m 'small one-line change'
      echo b >> a; git commit -am 'adds some stuff after'
      ...

  * Expected behavior from those commands.

  * Actual behavior from those commands.

In other words, rather than burdening people with the task of
constructing a mental picture of what you have done, you should
show them as directly and precisely as possible; in this way,
people can go about the business of discussing your issue much
more quickly and, most importantly, PRECISELY.

Sincerely,
Michael Witten

  reply	other threads:[~2012-05-11 23:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 22:25 surprising behavior from merge Sebastian Kuzminsky
2012-05-11 23:57 ` Michael Witten [this message]
2012-05-12  0:05   ` Sebastian Kuzminsky
2012-05-12  2:25     ` Illia Bobyr
2012-05-14 18:14       ` Sebastian Kuzminsky

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=ae419d8bbc2b44bfa4c0a7eb421f5037-mfwitten@gmail.com \
    --to=mfwitten@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=seb@highlab.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).