git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Green <Kevin.T.Green@morganstanley.com>
To: git@vger.kernel.org
Subject: confusion over git-cherry-pick, git-merge and git-cherry
Date: Wed, 24 Feb 2010 16:39:23 -0500	[thread overview]
Message-ID: <20100224213923.GV14244@morganstanley.com> (raw)


Hi,


Given this scenario:

  Work is done over a series of commits on branch 'alpha'.  A commit is
  cherry-pick'd from 'alpha' onto branch 'beta'.  Later, branch 'alpha'
  is merged into branch 'beta', I'm seeing unexpected output from
  git-cherry.

  Here's what the history currently looks like:


                      B'-----M beta
                    /       /
               o---A---B---C alpha


I would expect git-cherry to recognize that B' has the same content as
B and thus show me a '-' sign in front.  Instead, I get the following
output from 'git-cherry alpha beta'

  $ git cherry alpha beta
  + B'

The output of git-log looks like this (which is also unfortunate):

  $ git log --pretty=oneline
  M  Merge branch 'alpha' into beta
  B' change 2
  C  change 3
  B  change 2
  A  change 1
  o  initial commit


The output of git-patch-id for B and B' is identical.  

Can someone please explain to me why git-cherry doesn't notice that the
duplicate commit has the same content?  Shouldn't it?   Shouldn't I get
the following output:

  $ git cherry alpha beta
  - B'

that is, there exists a commit on beta that doesn't exist in alpha, but
the content there is the same?


How do others deal with cherry-pick and merge combined together?


To give some further background on what I'm trying to do, I would like
to prevent changes getting made in the beta branch that don't already
exist in alpha.  I'm enforcing this with a server side hook that does a
git-cherry and checks if any of the lines start with a '+'.  This works
great until I allow changes to be cherry-picked from alpha.  The first
cherry-pick works, but then when the whole of alpha is later merged in,
the hook fails to allow any subsequent push to 'beta'.


Thanks

--Kevin

             reply	other threads:[~2010-02-24 21:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-24 21:39 Kevin Green [this message]
2010-02-24 23:07 ` confusion over git-cherry-pick, git-merge and git-cherry Thomas Rast

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=20100224213923.GV14244@morganstanley.com \
    --to=kevin.t.green@morganstanley.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).