{"thread":{"id":"23020","subject":"FEATURE REQUEST: Cherry pick in not checked out branch","startedAt":"2010-03-15T08:39:38Z","lastAt":"2010-03-15T13:12:19Z","messageCount":6,"participants":["Maxim Treskin","Tim Mazid","Sverre Rabbelier","Michael J Gruber","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"136816","messageId":"be8f531d1003150139p7cc99700m807ab21bddf8fbb@mail.gmail.com","threadId":"23020","inReplyTo":null,"subject":"FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Maxim Treskin","fromEmail":"zerthurd@gmail.com","sentAt":"2010-03-15T08:39:38Z","receivedAt":"2010-03-15T08:39:38Z","isPatch":false,"sender":{"key":"zerthurd@gmail.com","avatar":null},"body":"Hello\n\ngit cherry-pick applies the change introduced by specified commit only\nto currently checked out branch. Why this requirement exists? Is it\npossible to apply changes to not checked out branch, like:\n\n$ git cherry-pick <branch> <commit>\n\nThank you\n\n-- \nMaxim Treskin\n"},{"id":"136818","messageId":"SNT124-W7E62082A3E852696A9036C42E0@phx.gbl","threadId":"23020","inReplyTo":"be8f531d1003150139p7cc99700m807ab21bddf8fbb@mail.gmail.com","subject":"RE: FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2010-03-15T08:55:17Z","receivedAt":"2010-03-15T08:55:17Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\nThat's actually a very good point. I could have used such a feature on a number of occasions. \nI second this feature request.\n\n> Date: Mon, 15 Mar 2010 14:39:38 +0600\n> Subject: FEATURE REQUEST: Cherry pick in not checked out branch\n> From: zerthurd@gmail.com\n> To: git@vger.kernel.org\n> \n> Hello\n> \n> git cherry-pick applies the change introduced by specified commit only\n> to currently checked out branch. Why this requirement exists? Is it\n> possible to apply changes to not checked out branch, like:\n> \n> $ git cherry-pick <branch> <commit>\n> \n> Thank you\n> \n> -- \n> Maxim Treskin\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n \t\t \t   \t\t  \n_________________________________________________________________\nLink all your email accounts and social updates with Hotmail. Find out now.\nhttp://windowslive.ninemsn.com.au/oneinbox?ocid=T162MSN05A0710G"},{"id":"136821","messageId":"fabb9a1e1003150243o21bab937y122ac61d65777d5f@mail.gmail.com","threadId":"23020","inReplyTo":"be8f531d1003150139p7cc99700m807ab21bddf8fbb@mail.gmail.com","subject":"Re: FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-15T09:43:14Z","receivedAt":"2010-03-15T09:43:14Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Mon, Mar 15, 2010 at 09:39, Maxim Treskin <zerthurd@gmail.com> wrote:\n> git cherry-pick applies the change introduced by specified commit only\n> to currently checked out branch. Why this requirement exists? Is it\n> possible to apply changes to not checked out branch, like:\n\nBecause you need a working directory to resolve conflicts.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"136822","messageId":"SNT124-W1769013489F8B7CE42C581C42E0@phx.gbl","threadId":"23020","inReplyTo":"fabb9a1e1003150243o21bab937y122ac61d65777d5f@mail.gmail.com","subject":"RE: FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Tim Mazid","fromEmail":"timmazid@hotmail.com","sentAt":"2010-03-15T09:54:32Z","receivedAt":"2010-03-15T09:54:32Z","isPatch":false,"sender":{"key":"timmazid@hotmail.com","avatar":null},"body":"\nHi,\n \nCould we not make cherry-pick \"stash, checkout, cherry-pick, checkout, pop\"?\n \nCheers,\nTim.\n----------------------------------------\n> From: srabbelier@gmail.com\n> Date: Mon, 15 Mar 2010 10:43:14 +0100\n> Subject: Re: FEATURE REQUEST: Cherry pick in not checked out branch\n> To: zerthurd@gmail.com\n> CC: git@vger.kernel.org\n>\n> Heya,\n>\n> On Mon, Mar 15, 2010 at 09:39, Maxim Treskin  wrote:\n>> git cherry-pick applies the change introduced by specified commit only\n>> to currently checked out branch. Why this requirement exists? Is it\n>> possible to apply changes to not checked out branch, like:\n>\n> Because you need a working directory to resolve conflicts.\n>\n> --\n> Cheers,\n>\n> Sverre Rabbelier\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at http://vger.kernel.org/majordomo-info.html\n \t\t \t   \t\t  \n_________________________________________________________________\nLooking for a new home? With all the latest places, searching has never been easier.\nhttp://clk.atdmt.com/NMN/go/157631292/direct/01/"},{"id":"136825","messageId":"4B9E13A4.3090502@drmicha.warpmail.net","threadId":"23020","inReplyTo":"SNT124-W1769013489F8B7CE42C581C42E0@phx.gbl","subject":"Re: FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-15T11:01:56Z","receivedAt":"2010-03-15T11:01:56Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Tim Mazid venit, vidit, dixit 15.03.2010 10:54:\n> \n> Hi,\n>  \n> Could we not make cherry-pick \"stash, checkout, cherry-pick, checkout, pop\"?\n\nSure, that would be 5 command invocations requiring a work tree ;)\n\nSeriously, you can make this into an alias or custom commend, of course,\nbut it would possibly need to stop in a state of conflict, the very same\nway that rebase -i may. There are structural improvements on the way\nwhich will make rebase -i, cherry-pick and so on use the same underlying\ncode base, and that will help implementing requests such as this one.\n\nMichael\n\nP.S.: Please don't top-post (I cut it).\nP.P.S.: Please don't cull cc (I re-added SR).\n"},{"id":"136830","messageId":"alpine.DEB.1.00.1003151359440.7596@pacific.mpi-cbg.de","threadId":"23020","inReplyTo":"4B9E13A4.3090502@drmicha.warpmail.net","subject":"Re: FEATURE REQUEST: Cherry pick in not checked out branch","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2010-03-15T13:12:19Z","receivedAt":"2010-03-15T13:12:19Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 15 Mar 2010, Michael J Gruber wrote:\n\n> Tim Mazid venit, vidit, dixit 15.03.2010 10:54:\n> \n> > Could we not make cherry-pick \"stash, checkout, cherry-pick, checkout, \n> > pop\"?\n> \n> Sure, that would be 5 command invocations requiring a work tree ;)\n\nActually, if you want something that does not change all the timestamps, \nand that does only trivial merges (i.e. no conflicts), you may have luck \nwith something like this:\n\n\ttest $# = 2 || {\n\t\techo \"Usage: $0 <commit> <branch>\" >&2\n\t\texit 1\n\t}\n\tGIT_INDEX_FILE=.git/tmp.index &&\n\texport GIT_INDEX_FILE &&\n\tgit read-tree \"$2\" &&\n\tgit diff \"$1\"^! | git apply --index &&\n\ttree=$(git write-tree) &&\n\tmsg=\"$(git cat-file commit \"$1\" | sed '1,/^$/d')\" &&\n\tcommit=$(echo \"$msg\" | git commit-tree $tree -p \"$2\") &&\n\tgit update-ref -m cherry-pick-2.0 \"$2\" $commit\n\nTotally Untested(tm),\nDscho\n"}]}