From: Johannes Schindelin Date: Mon, 15 Mar 2010 13:12:19 GMT Subject: Re: FEATURE REQUEST: Cherry pick in not checked out branch Message-ID: In-Reply-To: <4B9E13A4.3090502@drmicha.warpmail.net> Hi, On Mon, 15 Mar 2010, Michael J Gruber wrote: > Tim Mazid venit, vidit, dixit 15.03.2010 10:54: > > > Could we not make cherry-pick "stash, checkout, cherry-pick, checkout, > > pop"? > > Sure, that would be 5 command invocations requiring a work tree ;) Actually, if you want something that does not change all the timestamps, and that does only trivial merges (i.e. no conflicts), you may have luck with something like this: test $# = 2 || { echo "Usage: $0 " >&2 exit 1 } GIT_INDEX_FILE=.git/tmp.index && export GIT_INDEX_FILE && git read-tree "$2" && git diff "$1"^! | git apply --index && tree=$(git write-tree) && msg="$(git cat-file commit "$1" | sed '1,/^$/d')" && commit=$(echo "$msg" | git commit-tree $tree -p "$2") && git update-ref -m cherry-pick-2.0 "$2" $commit Totally Untested(tm), Dscho