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

Re: How to pull only a few files from one branch to another?

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jan 24, 2007, 10:16 UTC
Message-ID
<Pine.LNX.4.63.0701241104300.22628@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<Pine.LNX.4.64.0701231937310.3606@woody.linux-foundation.org>
Hi,
On Tue, 23 Jan 2007, Linus Torvalds wrote:
Show 13 quoted lines
> NOTE NOTE NOTE! I don't actually think "git merge-one-file" really works 
> correctly as-is for your usage case. It _kind_of_ gets the result you 
> want, but it's not really written to be used like that, and you'll get an 
> error from the
> 
> 	git-checkout-index -f --stage=2 -- "$4" &&
> 		cat "$src1" >"$4"
> 
> stage because stage 2 didn't exist ("git-merge-one-file" is really only 
> supposed to be called by a real merge).
> 
> But it's _almost_ usable that way. Maybe Dscho or Junio wants to make it 
> work the extra final mile.

I don't really see the point, but yes, it would be easy enough (at least in the builtin version I sent out last night).

Note that the checkout-index is used _purely_ to set the correct mode (at least as far as I can tell). *Clickety-click* well, seems you had something different in mind on June 8th, 2005. "make sure that the full pathname is created". This, of course, is missing from the builtin merge-one-file (yet).

> Not exactly pretty. If this is something people want to do often, we'd 
> need to generate some porcelain for it.

I fully expect people to agree that this is not the way to go. I think cherry-picking is what you were after, Bill, correct?

Having said that, I find myself picking changes from a side-branch (with too many one-liner commits) with this command:

	git diff -R sidebranch file1 file2.. | git apply --index

Ciao, Dscho

Previous: Johannes SchindelinNext: Bill Lear
Message 5 of 18 in “How to pull only a few files from one branch to another?”
  1. Bill LearJan 24, 2007
  2. Linus TorvaldsJan 24, 2007
  3. Linus TorvaldsJan 24, 2007
  4. Johannes SchindelinJan 24, 2007
  5. Johannes SchindelinJan 24, 2007
  6. Bill LearJan 24, 2007
  7. Yann DirsonJan 24, 2007
  8. Jakub NarebskiJan 24, 2007
  9. Yann DirsonJan 24, 2007
  10. Jakub NarebskiJan 24, 2007
  11. Linus TorvaldsJan 24, 2007
  12. Daniel BarkalowJan 24, 2007
  13. Bill LearJan 24, 2007
  14. Shawn O. PearceJan 24, 2007
  15. Andy WhitcroftJan 24, 2007
  16. Junio C HamanoJan 24, 2007
  17. Jakub NarebskiJan 24, 2007
  18. Daniel BarkalowJan 24, 2007

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.