git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] revert.c: Allow to specify -x via git-config

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 18, 2014, 19:20 UTC
Message-ID
<20140218192039.GC7855@google.com>
In-Reply-To
<20140218183842.GA163138@vauxhall.crustytoothpaste.net>
brian m. carlson wrote:
Show 10 quoted lines
> 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

Previous: brian m. carlsonNext: Guido Günther
Message 5 of 10 in “revert.c: Allow to specify -x via git-config”
  1. revert.c: Allow to specify -x via git-configGuido Günther, Feb 18, 2014
  2. John KeepingFeb 18, 2014
  3. Jonathan NiederFeb 18, 2014
  4. brian m. carlsonFeb 18, 2014
  5. Jonathan NiederFeb 18, 2014
  6. 0/3 Allow to configure cherry-pick's record originGuido Günther, Feb 18, 2014
  7. 1/3 revert.c: Allow to specify -x via git-configGuido Günther, Feb 18, 2014
  8. Junio C HamanoFeb 19, 2014
  9. 2/3 revert.c: Add --record-originGuido Günther, Feb 18, 2014
  10. 3/3 revert.c Allow to override cherrypick.recordOriginGuido Günther, Feb 18, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.