1

svn:externals "http://svn.3rdapp.com/project/subdir/subdir/ lib/mydir/subdir"

SVN allows developers to include sub-directories of 3rd party libraries into sub-directories of their own repo.

I'd like to include only a sub-directory of the 3rd party lib into my project, likely as a subtree which can be edited and new upstream changes merged with my edits.

Specifically https://github.com/openid/php-openid/tree/master/Auth included into Vendor/Auth without any of the files or history from the other directories.

MrYellow
  • 426
  • 6
  • 23
  • Similar question: [combine-subtree-merge-with-sparse-checkout-in-git](http://stackoverflow.com/questions/9707612/combine-subtree-merge-with-sparse-checkout-in-git) – MrYellow Jun 12 '13 at 23:09

1 Answers1

0

You can use the sparseCheckout feature of Git which was introduced in version 1.7.0. It allows you to include specific sub directories of a repository in your project. Try this following steps:

  1. git clone https://github.com/openid/php-openid.git Vendor/Auth
  2. cd Vendor/Auth
  3. git config core.sparsecheckout true
  4. echo Auth/ > .git/info/sparse-checkout
  5. git read-tree -m -u HEAD

In step #4 above, Auth subdirectory (which you want to use) is added to the .git/info/sparse-checkout file.

If later your decide to change which subdirectory you would like to use then just edit the sparse-checkout file and redo step #5.

Aziz Shaikh
  • 16,245
  • 11
  • 62
  • 79
  • 1
    Is it possible to use sparsecheckout and read-tree with a subtree? Would be good to be able to update the 3rd party lib separate to the main repo. – MrYellow Jun 12 '13 at 23:12