Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just as an alternative to the SO question "<a href="https://stackoverflow.com/questions/449541/how-do-you-merge-selective-files-with-git-merge">How do you merge selective files with git-merge?</a>", I just found <a href="http://support.github.com/discussions/repos/4733-merging-a-subdirectory-of-remote-branch-into-a-subdirectory-on-my-fork#comment_3698745" rel="noreferrer">this GitHub thread</a> which could be more adapted for merging a whole subdirectory, based on <strong><a href="http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html" rel="noreferrer">git read-tree</a></strong>:</p> <blockquote> <ul> <li><p>My repository => <code>cookbooks</code><br> My repository target directory => <code>cookbooks/cassandra</code></p></li> <li><p>Remote repository => <code>infochimps</code><br> Remote repository source I want merged into <code>cookbooks/cassandra</code> => <code>infochimps/cookbooks/cassandra</code></p></li> </ul> <p>Here are the commands I used to merge them</p> <ul> <li>Add the repository and fetch it</li> </ul> </blockquote> <pre> git remote add -f infochimps git://github.com/infochimps/cluster_chef.git </pre> <blockquote> <ul> <li>Perform the merge</li> </ul> </blockquote> <pre> git merge -s ours --no-commit infochimps/master </pre> <blockquote> <ul> <li><strong>Merge only <code>infochimps/cookbooks/cassandra</code> into <code>cassandra</code></strong></li> </ul> </blockquote> <pre> git read-tree --prefix=cassandra/ -u infochimps/master:cookbooks/cassandra </pre> <blockquote> <ul> <li>Commit the change</li> </ul> </blockquote> <pre> git commit -m 'merging in infochimps cassandra' </pre> <hr> <h3>Addendum</h3> <p>It's bizarre,<sup>[edit me]</sup> — but the <code>read-tree</code> step can possibly fail like this:</p> <blockquote> <p><code>error: Entry 'infochimps/cookbooks/cassandra/README' overlaps with 'cookbooks/cassandra/README'. Cannot bind.</code></p> </blockquote> <p>... even when both files are <em>identical</em>. This might help:</p> <pre><code>git rm -r cassandra git read-tree --prefix=cassandra/ -u infochimps/master:cookbooks/cassandra </code></pre> <p>But off course, verify manually that this does what you want.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload