GIT: how to use one database of blobs for two repos

I have a huge GIT repo that contains the history of a certain folder, and another (second) folder that contains ~50% of the same (identical) files as the first one and another ~50% of its own files not present in the first folder.

For a number of reasons I want GIT to use the blobs in the first folder‘s .git dir for managing the history of the second folder. The repositories themselves should be (or at least appear) independent. How do I achieve this?
enter image description here

  • Deflate command line tool
  • Where does the term blob come from in the context of git?
  • pygit2 blob history
  • How to fix git missing blob?
  • gitignore by file size?
  • Set up git so the repository only contains the latest of certain blob files
  • git-svn: branch renamed in svn repository, how do I tell git-svn?
  • How do you move a commit to the staging area in git?
  • Is there a better way to review your own changes instead of “git diff”
  • Jenkins build 'cannot find current revision' at GitHub
  • How do I take git repo and make a new project based on it
  • SVN:Externals equivalent for Git
  • One Solution collect form web for “GIT: how to use one database of blobs for two repos”

    Git can do this via objects/info/alternates. Documentation can also be found searching for git clone --reference.

    You do have to be careful how you set this up as you do not want garbage collection in one repo to remove objects that the other repo needs.

    https://git-scm.com/docs/gitrepository-layout
    https://git-scm.com/docs/git-clone

    Edit

    Wait a second, are the two folders in the same repo, or in different repos? My answer was for if they are in different repos. If they are in the same repo, git will just handle this automatically because the files’ hashes will be the same so they will automatically be saved in the same blob.

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