tags:

views:

292

answers:

1

Is it possible to merge only the changes for a sub-directory from a local git branch to a remote git branch or is it "all or nothing"?

For example, I have:

branch-a
 - content-1
 - dir-1
   - content-2

and

branch-b
 - content-1
 - dir-1
   - `content-2

I only want to merge the contents of branch-a dir-1 with the contents of branch-b dir-1.

A: 

I think this is a duplicate of this other question:

how-do-you-merge-selective-files-with-git-merge

Karl Voigtland
That seems like its aimed at selective files; not entire sub dirs. Is there an easier way to merge sub dirs or does it require the stuff laid out in that thread?
Brad Gessler
The techniques in that thread should apply as well. There really is no notion of a selective merge (as in merge the histories of two branches) of files or directories since git is really working with content and commits.
Karl Voigtland