clone parts of a github project

Dennis picture Dennis · Oct 24, 2009 · Viewed 22.7k times · Source

Possible Duplicate:
Is there any way to clone a git repository’s sub-directory only?

I'm trying to clone parts of a github project but I can only get the root folder. This is the first time im trying to use github and I just installed tortoisegit, im used to svn and cvs where you could just take a folder you wanted to checkout, but it seems git only got a .git file in the root folder so im not sure what to do.

Answer

JasonSmith picture JasonSmith · Oct 24, 2009

There is the subtree merge.

But here is an easier but partial solution that perhaps is good enough for your needs. Just fork and periodically merge back.

  1. Fork (clone) the repository
  2. Remove parts you do not need and move the sub-folder to where you do need
  3. Commit

In the future, when you want to sync back up with the upstream Git code, just merge it with your fork. The files which you kept will sync back up with those from upstream, and you might have some small cleanups to do which are easy to see from git status.