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

Re: two git-cherry-pick enhancements

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 22, 2008, 09:29 UTC
Message-ID
<alpine.DEB.1.00.0805221026140.30431@racer>
In-Reply-To
<20080521163817.GA13124@denkbrett.schottelius.org>
Hi,
On Wed, 21 May 2008, Nico -telmich- Schottelius wrote:
Show 13 quoted lines
> When using git-cherry-pick there are two things missing for me and just 
> wondered how you see it (or maybe have a good solution):
> 
> - Apply only parts of the patch which applies to <file ...>:
>    I sometimes want to apply patches only to some, but not all
>    files the patch introduces
> 
> - Interactively selecting which parts to apply:
>    I want only 7 out of 10 changes the patch introduces.
>    It would help alot, if I could choose which parts I want
>    to apply for every part of the patch.
> 
> Anything planned like that or did I oversee the right way?

Conceptually, this is really not cherry-picking _commits_. For example, the commit message will typically be all wrong if you pick only one change. Also, if I were the author of the original patch, I would not be happy for you to label me author of the cut-down (and possibly invalid) commit.

Therefore I suggest (just like on IRC the other day):
	git show <commit> -- <file(s)> | git apply
possibly followed by
	git add -i
or
	git add -p <file>

Hth, Dscho

Previous: Sitaram Chamarty
Message 4 of 4 in “two git-cherry-pick enhancements”
  1. Nico -telmich- SchotteliusMay 21, 2008
  2. Govind SalinasMay 21, 2008
  3. Sitaram ChamartyMay 22, 2008
  4. Johannes SchindelinMay 22, 2008

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.