How to selectively clone a git repository

I am new to Git. I want to clone a large remote repository lets say xyzcodebase. The structure of repo is like I have src folders for different functional areas as shown below.

xyzcodebase
|
|__ Func area 1
|
|__ Func area 2

I work on Functional area 2 hence while cloning I don’t want code from Functional area 1 (large size) which will save lots of my time. So that after cloning I will have only Functional area 2 source code on my local repository.

  • Difference in GIT betw. branch, clone and snapshot
  • Git clone with custom SSH using GIT_SSH error
  • how to recreate old commits that got missing and unreachable at repository move
  • Can't clone git repo
  • Mercurial clone from a branch
  • Aptana 3, GitHub can clone but can't commit
  • Is there a way to accomplish such selective cloning of git repository?

    Thanks in advance for your help

  • git submodule update --init Error while installing dot-emacs files
  • Are remote git clients vulnerable to CVE-2014-9390 if only trusted users have SSH access?
  • git log suppress refs matching specified pattern
  • How do I fork multiple projects into one repository with git?
  • Plumbing equivalent for `git checkout — .`
  • How to push to github from cloud9?
  • 2 Solutions collect form web for “How to selectively clone a git repository”

    No, there is no way to only clone one directory. Git stores history as changes to whole repository instead of storing only subtrees as SVN.

    If your project contains multiple functionalities, then maybe it would be better to split it into some sub-projects, with different repositories, and then include other repositories as submodules in master project. But it depends how your project is organized.

    This is a hacky solution that might in special cases help with your issue. Specifically if you are only interested in a single file you could simply download it from the console (in Unix) via wget:
    wget https://raw.githubusercontent.com/GITHUBUSER/REPOSITORY/master/file.ending

    You can get the link of a specific file by navigating to it in github and then click on “raw”.

    Git Baby is a git and github fan, let's start git clone.