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?