git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Adam Monsen <haircut@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: configuring cherry-pick to always use -x?
Date: Mon, 14 Feb 2011 13:09:32 -0500	[thread overview]
Message-ID: <AANLkTin0xB=hJ-v21+esT6Zqj2f53XiwD8tBW4qFkuVy@mail.gmail.com> (raw)
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. :-)

> 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.

  reply	other threads:[~2011-02-14 18:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 17:19 configuring cherry-pick to always use -x? Adam Monsen
2011-02-14 18:09 ` Jay Soffian [this message]
2011-02-14 21:23   ` Junio C Hamano
2011-02-14 21:05 ` Junio C Hamano
2011-02-14 21:50   ` Adam Monsen
2011-02-15  8:58     ` Michael J Gruber
2011-02-15  9:18       ` Jonathan Nieder
2011-02-15  9:29         ` Michael J Gruber
2011-02-15 16:16       ` Jay Soffian
2011-02-15 21:03       ` release maintenance vs. release engineering (was: configuring cherry-pick to always use -x?) Adam Monsen
2011-02-14 21:53   ` configuring cherry-pick to always use -x? Jay Soffian
2011-02-15  9:38   ` Ivan Kanis

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTin0xB=hJ-v21+esT6Zqj2f53XiwD8tBW4qFkuVy@mail.gmail.com' \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=haircut@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).