All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: <stefan.naewe@atlas-elektronik.com>
Cc: <richard.kerry@eviden.com>,  <git@vger.kernel.org>
Subject: Re: Merge selected files or folders
Date: Fri, 22 Mar 2024 10:23:41 -0700	[thread overview]
Message-ID: <xmqqa5mq18pu.fsf@gitster.g> (raw)
In-Reply-To: <c3f144b20cef46de83f2282dd16a817f@atlas-elektronik.com> (stefan naewe's message of "Fri, 22 Mar 2024 12:24:04 +0000")

<stefan.naewe@atlas-elektronik.com> 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?


      reply	other threads:[~2024-03-22 17:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-21 16:50 Merge selected files or folders Richard Kerry
2024-03-21 17:50 ` Junio C Hamano
2024-03-22  9:39   ` Sergey Organov
2024-03-22  9:56     ` Konstantin Khomoutov
2024-03-22 10:27       ` Dragan Simic
2024-03-22 12:24   ` stefan.naewe
2024-03-22 17:23     ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqa5mq18pu.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=richard.kerry@eviden.com \
    --cc=stefan.naewe@atlas-elektronik.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.