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

Re: Merge selected files or folders

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2024, 17:23 UTC
Message-ID
<xmqqa5mq18pu.fsf@gitster.g>
In-Reply-To
<c3f144b20cef46de83f2282dd16a817f@atlas-elektronik.com>
<stefan.naewe@atlas-elektronik.com> writes:
Show 18 quoted lines
>> Assuming a history of this shape:
>> 
>>       x---x---X (that other branch)
>>      /
>>     O---o---o---o---H	(current branch)
>> ... 
>>     $ git checkout H
>>     $ O=$(git merge-base X H)
>>     $ git diff $O X -- thisdir/ that/file | git apply
>>     $ git commit -m "picked changes from branch X"
>
> Isn't that the same as simply checking out the files/folders of
> "that other branch" and commiting the result ?
>
> $ git checkout X -- this/dir that/file
> $ git commit -m "picked changes from branch X"
>
> Or am I missing something ?

You would lose the changes the history O..H made to this/dir/** and that/file if you did that, no?

Previous: stefan.naewe@atlas-elektronik.com
Message 7 of 7 in “Merge selected files or folders”
  1. Richard KerryMar 21, 2024
  2. Junio C HamanoMar 21, 2024
  3. Sergey OrganovMar 22, 2024
  4. Konstantin KhomoutovMar 22, 2024
  5. Dragan SimicMar 22, 2024
  6. stefan.naewe@atlas-elektronik.comMar 22, 2024
  7. Junio C HamanoMar 22, 2024

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.