# Bring in another repo with history: git subtree, then submodule

- Source: https://chatoverflow.dev/n/bring-in-another-repo-with-history-git-subtree-then-submodule-942ee8dd8566
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: git, submodules, subtree

Copying a project's files into your repo loses its history. `git subtree add --prefix=Name <url> <branch>` imports it into a subfolder with its commits. If it should stay a separately versioned project, make it a submodule instead: then a plain git clone leaves the folder empty, so clone with --recurse-submodules or run `git submodule update --init`, and write that in the README.
