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

Re: configuring cherry-pick to always use -x?

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 14, 2011, 18:09 UTC
Message-ID
<AANLkTin0xB=hJ-v21+esT6Zqj2f53XiwD8tBW4qFkuVy@mail.gmail.com>
In-Reply-To
<4D596435.9020605@gmail.com>
On Mon, Feb 14, 2011 at 12:19 PM, Adam Monsen <haircut@gmail.com> wrote:
> Is there a configuration option to make cherry-pick always include the
> source commit hash in the new commit log message?
>
> e.g., make "git cherry-pick" always behave like "git cherry-pick -x"?
Nope, but one would be appreciated. :-)
Show 8 quoted lines
> My most frequent use case for cherry picking is between publicly visible
> branches.
>
> I have the following configuration option set:
>
>  alias.cpx=cherry-pick -x
>
> but I rarely remember to use it.

It's worse than that. I like to keep the message generated after a cherry-pick conflict, but the original commit authorship. I have this, which I call recommit:

<snip> #!/bin/sh # Used after a cherry-pick conflicts to commit with the original # authorship (commit -c) but keep the newly generated commit message # self=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0") . "$(git --exec-path)/git-sh-setup" require_work_tree cd_to_toplevel test -f .git/MERGE_MSG || die "No .git/MERGE_MSG"

if test "$GIT_EDITOR" = "$self"
then
  cat .git/MERGE_MSG > .GIT/COMMIT_EDITMSG
  exit 0
fi
if sha1=$(sed -ne \
  's/^(cherry picked from commit \([a-f0-9]\{40\}\))$/\1/p' .git/MERGE_MSG)
then
  export GIT_EDITOR="$self"
  git commit -c $sha1
fi
</snip>
I've had it on my TODO list for a while now to:
1. add a config option to enable -x by default
2. improve the cherry-pick conflict UX. I was thinking of out
CHERRY_HEAD on conflict and then adding a cherry-pick --continue
option which acts like rebase --continue. CHERRY_HEAD is what was
being picked at the time of conflict and can be used by the bash
completion script for proper prompting, as well as obviously the
--continue option.
j.
Previous: Adam MonsenNext: Junio C Hamano
Message 2 of 12 in “configuring cherry-pick to always use -x?”
  1. Adam MonsenFeb 14, 2011
  2. Jay SoffianFeb 14, 2011
  3. Junio C HamanoFeb 14, 2011
  4. Junio C HamanoFeb 14, 2011
  5. Adam MonsenFeb 14, 2011
  6. Michael J GruberFeb 15, 2011
  7. Jonathan NiederFeb 15, 2011
  8. Michael J GruberFeb 15, 2011
  9. Jay SoffianFeb 15, 2011
  10. release maintenance vs. release engineering (was: configuring cherry-pick to always use -x?)Adam Monsen, Feb 15, 2011
  11. Jay SoffianFeb 14, 2011
  12. Ivan KanisFeb 15, 2011

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.