From: "Philip Oakley" <philipoakley@iee.org>
To: "Mike Stump" <mikestump@comcast.net>
Cc: "Jakub Narebski" <jnareb@gmail.com>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
<git@vger.kernel.org>
Subject: Re: cherry picking and merge
Date: Sat, 2 Aug 2014 17:29:31 +0100 [thread overview]
Message-ID: <7CCCA1CCC7F342FA9037AAFEDCEDB53F@PhilipOakley> (raw)
In-Reply-To: FC00A4BB-6CB9-421D-83D6-4E1AFBB4CB3C@comcast.net
From: "Mike Stump" <mikestump@comcast.net>
Sent: Friday, August 01, 2014 11:10 PM
(part 2)
> On Aug 1, 2014, at 11:57 AM, Philip Oakley <philipoakley@iee.org>
> wrote:
>> For some central control use styles, the ideas behind _distributed_
>> version control are anathema and (Git) just grinds away at the
>> policies that are expected.
> ...
>> of the 'relativity' that comes with being distributed - truth has to
>> give way to a web of trust). Also the artefacts that Git validates
>> are at a different level of abstraction i.e. the whole project as a
>> commit, rather than just a few/one file at a time.
>
> Ah, so that gives me an idea. [ pause ] If we try the cherry-pick as
> retroactively creating a feature branch, cherrying into that, then
> merge unconditionally so that no change happens that into trunk (thus
> killing those conflicts), and then git merge that feature branch into
> branch then it all works perfectly. See, another existence proof that
> you are wrong, this time with git itself.
>
> It was 13 lines of code, so, apparently, it is possible and easy to
> do, in git. Now, we just want the cherry-pick to create a temporary
> cherry branch, cherry the pick into it, merge and drop into trunk and
> merge into branch…
>
> I tested with the below and it worked just fine. Things to clean up,
> we want the meta data on the cherry on the merge commit, but, you get
> the idea.
>
I've annotated some of the bits to make sure we are on the same
wavelength as to what this does...
> branch=b
> master=master
> base=$(git merge-base $branch $master)
> cherry="$1" # not quite sure where this commit is located relative to
> either $branch or $master
>
# create a new branch, starting at base, for our cherry picked commit
> git checkout -b cherry-$branch $base
> git cherry-pick "$cherry" # which also commits onto our cherry pick
> barnch
> git checkout $master
> git merge -s ours cherry-$branch # "mark/remember" the cherry branch,
> its fix and it's base point, but don't actualy use it here on $master
> git checkout $branch
> git merge cherry-$branch # bring the 'fix' into $branch
> git branch -d cherry-$branch # remove the fix branch that started at
> $base - branches are ephemeral anyway.
# still on $branch, which already has the change merged in (Git style) ?
> git cherry-pick --strategy=ours --allow-empty "$cherry" # check its
> all already included?
> git commit --allow-empty
>
Does my annotation match your understanding? It wasn't clear to me where
$1 had been hiding previously, nor why the common fix didn't use a
"merge -s ours cherry-$branch" in both cases - that maybe my
misunderstanding about how your workflow goes.
> I tested that with two cherries with further changes on master to
> ensure that it works for more than a single one, no problem. Wow,
> even tried a merge of master back into b, and it worked just fine, no
> conflicts, yet, all the code was jammed up together nicely.
>
> So, if you wish to continue your position, please explain why it can’t
> get this better, given the existence proof above of it working better
> in git.
>
...
> I have two possible conflict fixups in the above. In my case (I have
> a specific patch in gcc-land i wanted to cherry), those fixups were
> trivial (no conflicts). When they are trivial, I don’t care much that
> there were two of them. When non-trivial, well, I’m resigned to the
> idea that I have to explain what is going on.
>
>> Selecting a compatible workflow is a problem of usage,
>
> Not when the workflow is mandated on you to work around trivial little
> bugs that can be fixed but for which the author’s don't even
> comprehend the bug.
>
>> rather than a problem in Git.
> --
Philip.
next prev parent reply other threads:[~2014-08-02 16:29 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-01 0:58 cherry picking and merge Mike Stump
2014-08-01 2:43 ` brian m. carlson
2014-08-01 16:27 ` Jakub Narębski
2014-08-01 17:48 ` Mike Stump
2014-08-01 18:57 ` Philip Oakley
2014-08-01 22:10 ` Mike Stump
2014-08-02 10:39 ` Philip Oakley
2014-08-02 16:29 ` Philip Oakley [this message]
[not found] ` <CANQwDwc4YPdK+a0Oc-jWPTRyM5GiP-CMuRY1inxJY41GwUGBvQ@mail.gmail.com>
2014-08-01 19:01 ` Fwd: " Jakub Narębski
2014-08-01 22:24 ` Mike Stump
2014-08-02 11:44 ` Philip Oakley
2014-08-06 15:43 ` Jakub Narębski
2014-08-06 18:41 ` Mike Stump
2014-08-01 20:12 ` Sam Vilain
2014-08-01 23:06 ` Mike Stump
2014-08-01 23:40 ` Nico Williams
2014-08-02 0:18 ` Alex Davidson
2014-08-06 19:11 ` Mike Stump
2014-08-06 19:44 ` Rebase safely (Re: cherry picking and merge) Nico Williams
2014-08-06 20:13 ` Nico Williams
[not found] ` <A769B84E-42D1-44AC-B0A8-0F4E68AB71FB@comcast.net>
2014-08-07 5:11 ` Nico Williams
2014-08-08 17:34 ` Mike Stump
2014-08-08 18:27 ` Nico Williams
2014-08-08 16:23 ` Fwd: " Mike Stump
2014-08-01 16:56 ` cherry picking and merge Mike Stump
2014-08-21 17:36 ` Keller, Jacob E
2014-08-21 17:58 ` Keller, Jacob E
2014-08-01 19:22 ` Nico Williams
2014-08-01 22:13 ` Mike Stump
2014-08-01 22:19 ` Nico Williams
2014-08-01 20:02 ` Jonathan Nieder
2014-08-01 20:50 ` Jonathan Nieder
2014-08-01 20:55 ` Nico Williams
2014-08-01 21:44 ` Junio C Hamano
2014-08-01 22:00 ` Nico Williams
2014-08-01 22:09 ` Junio C Hamano
2014-08-06 15:58 ` Jakub Narębski
2014-08-06 16:26 ` Nico Williams
2014-08-06 23:16 ` Junio C Hamano
2014-08-06 23:20 ` Junio C Hamano
2014-08-01 23:47 ` Mike Stump
2014-08-01 22:35 ` Mike Stump
2014-08-01 22:42 ` Jonathan Nieder
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=7CCCA1CCC7F342FA9037AAFEDCEDB53F@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=jnareb@gmail.com \
--cc=mikestump@comcast.net \
--cc=sandals@crustytoothpaste.net \
/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