brian m. carlson wrote:

> I can provide a use case.  At work, we merge into the maintenance and
> development branches and cherry-pick from the maintenance to the stable
> branches.  We want committers to always use -x -s because we need to
> know which reviewer backported the change and we want to be able to
> track which commits have been backported and whether any reverts also
> need to be cherry-picked.  We also have automated tools that want this
> information.
>
> I usually solve this with an alias (backport = cherry-pick -x -s), but I
> can see how this might be a useful option.

Thanks for the example.

Here the alias seems like a nicer solution than a configuration
changing the default behavior of "git cherry-pick" because

 (1) it is easy to temporarily turn the effect off, by using cherry-pick
     directly instead of using the alias

 (2) it doesn't affect scripts that use cherry-pick

 (3) The caller explicitly specifies their intent by running "git
     backport".  It doesn't affect unrelated uses of cherry-pick on
     other branches.

 (4) it can be set up globally and takes effect when appropriate
     without needing any special setup per repository

 (5) it also implements the other part of your backporting policy (-s)
     and if in the future you had more backporting rules (e.g., requirement
     to specify which commit introduced the regression that this backport
     solves) then it could be easily tweaked

All that said, I wouldn't mind some magic that changes the default
behavior of "git cherry-pick" as long as (1), (2), and (3) are
resolved somehow.  E.g.

 (i)   a working --no-record-origin option that overrides this config

 (ii)  a --porcelain or similar option or just better documentation
       about how scripts can protect themselves from further changes
       to 'git cherry-pick' behavior

 (iii) config applying per destination branch instead of globally

Hope that helps,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to