Subject: Re: Merge selected files or folders

From: Junio C Hamano <[email-masked]>
Date: Fri, 22 Mar 2024 10:23:41 -0700

<[email-masked]> writes:

>> 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?