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
Daniel Barkalow <barkalow@iabervon.org>
Date
Jan 24, 2007, 05:29 UTC
Message-ID
<Pine.LNX.4.64.0701240019250.20138@iabervon.org>
In-Reply-To
<17846.53626.895660.762096@lisa.zopyra.com>
On Tue, 23 Jan 2007, Bill Lear wrote:
> I have a long-running topic branch.  I have fixed a few nits on
> the master branch that I would like on the topic branch.  How do I
> pull in only a few files from the head of the master branch?

You don't pull in a few files, you apply the changes made in a few commits:

  git diff HEX_OF_NIT_FIX^ HEX_OF_NIT_FIX | git apply

If there's other stuff in the nit-fixing commit, shame on you, but you can edit the patch before applying it to remove everything that's not what you want.

(Incidentally, I think "git diff ^ {commit}" should be made to do "git diff {commit}^ {commit}"; i.e., if there is a single other revision provided, interpret a modifier not applied to anything as applying to that revision, in the "what else could that possibly mean?" department.)

	-Daniel
*This .sig left intentionally blank*
Previous: Linus TorvaldsNext: Bill Lear
Message 12 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.