Thread (3 messages) 3 messages, 3 authors, 2026-02-24

Re: Feature that allows the user to merge only specific files/folders from another branch

From: Thomas Guyot <hidden>
Date: 2026-02-24 19:21:33

On 2026-02-24 08:44, Sugiarto, Titania wrote:
Hi,

I have a suggestion for Git, which includes a feature that allows the user to merge (I want to highlight merge here, not replace) specific files/folders from another branch.
I feel like a lot of users have spoken about this online but up until now, there hasn't been an update regarding such feature.

Might be worthwhile to consider?
Hi Titania,

I believe what you are looking for is already easily doable with:

   git merge --no-commit

Then you can revert some of the changes you don't want in the index 
before running this to complete the merge:

   git merge --continue

Note that subsequent merges from that branch would not include the 
changes you skipped, that's the core concept of merging and you can't 
avoid it. That said you can also cherry-pick specific commits, also with 
the same --no-edit flag to allow editing the cherry pick.

Since cherry-picking is centered around individual commits, doing that 
for all commits of a forked branch might be difficult. It appears there 
a -m/--mainline switch in cherry-pick to allow that but I have never 
used it. You will have to experiment yourself if this is what you want.

Regards,

--
Thomas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help