How to commit a git repo into a git repo (not submodule)

When I try to add and commit a git repository into another git repository, git helpfully makes it into a submodule. What if I want to track and commit changes to that nested repository in the outer repo? I.e. I want the outer repository to track all the files in the nested repo’s working tree as well as its .git directory.

The use case here is that I want to maintain a git repository of my whole “projects” directory (many of which use git or another VCS) for versioned backups, as well as statistics collection. Going to a particular commit in the outer repo should show me the complete state of all projects at that time, including e.g. commits that may later have been rebased into oblivion.

  • What is the best way to back up an entire git repository on external disk?
  • How to make sure my git repo code is safe?
  • Add commits before root commit in Git?
  • How to separate/decouple git repository into a different location
  • Git: Automatically backing up all commits on creation
  • SVN repository backup strategies
  • Chronological list of branches?
  • How can I use RFC3161 (trusted) timestamps to prove the age of commits in my Git repository?
  • Prevent git from automatically generating user email if missing
  • configuring user and password with git bash
  • Git: How to return from 'detached HEAD' state
  • git remove merge commit from history
  • One Solution collect form web for “How to commit a git repo into a git repo (not submodule)”

    Not possible.

    After researching this further I found the answer is unfortunately that it is not possible. Git is hardcoded to ignore nested git repositories and cannot be told to index them.

    The most common git-like suggestion for the backup use case is bup, which seems fine for that use case alone, but can’t seem to do all that git can stats-wise.

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