Is it possible to clone a git repository, and split the clone repo, keeping track of the changes from original repo?

This might be somewhat unusual, but say I have a git repository A:


and clone this repository to B:

  • Jenkins: Get build numbers range on a particular day
  • Azure continuous build is failing with “Unable to initialize blade from definition”
  • Jenkins/Hudson - How to run multiple jobs in parallel more than 1 level deep?
  • Jenkins Multibranch Pipelines - Configuring properties in branches?
  • Github pages with polymer
  • How to mark a build unstable in Jenkins when running shell scripts
  • B/project1/...   

    What I want to do is to somehow split the project folders and their contents into individual units. It does not really matter if the unit is a branch, a repository or whatever, the important thing here is that I need to be able to efficiently fetch changes from repository A upstream, and track in B’s units.


    I want to use Jenkins and only build the projects if they contain changes, and Jenkins supports this for a single repository or branch. However, I can not change the original repository A. Alternative solutions are of course also very welcome.

  • Change the location where git looks for its dependency
  • Pull request vs Merge request
  • Git Windows Command Prompt gets stuck during Git commands with (END)
  • How to use Kaleidoscope 2 with Git Tower?
  • Why does Git only store branches under refs/remotes/origin?
  • Delete file from Git
  • One Solution collect form web for “Is it possible to clone a git repository, and split the clone repo, keeping track of the changes from original repo?”

    Sparse checkouts may be of help here.

    1. You need to clone the repository A.
    2. You then have to configure sparse checkout (after cloning):
      • git config core.sparsecheckout true
      • echo project1/ > .git/info/sparse-checkout
    3. Then you need to call git read-tree -m -u HEAD


    However the sparse checkout is not truly independent. Let us say you want only project1. Changes introduced by project2 or project3 in your case will suggest that your sparse checkout has changed.


    • Checkout sub directories in git
    Git Baby is a git and github fan, let's start git clone.