confusion over git-cherry-pick, git-merge and git-cherry

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]