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

Re: Git merge selective files

From
Alex Riesen <raa.lkml@gmail.com>
Date
Jun 9, 2009, 19:35 UTC
Message-ID
<81b0412b0906091235g7a65d076l145c3eb3cbbdce3@mail.gmail.com>
In-Reply-To
<34b359190906090253v653ecc71q6684f4ebff2be59d@mail.gmail.com>
2009/6/9 joe higton <draxil@gmail.com>:
Show 5 quoted lines
> Hi,
>     I want to merge changes from a branch but only to one file, I
> don't want to pick up the changes from other files. I've scoured
> google and the docs a bit but I can't find anything useful. Is this
> possible?

Generally - no. But you can have a merge with only the content of your choice:

  git merge -s ours --no-commit other

then copy the changes you need manually, and commit. See the manpage of git merge about "ours" merge strategy.

Previous: Avery PennarunNext: Avery Pennarun
Message 3 of 5 in “Git merge selective files”
  1. joe higtonJun 9, 2009
  2. Avery PennarunJun 9, 2009
  3. Alex RiesenJun 9, 2009
  4. Avery PennarunJun 9, 2009
  5. Junio C HamanoJun 9, 2009

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.