= git: fusion varios repos en 1 conservando historia
{{tag>git}}
/via: [[https://medium.com/@checko/merging-two-git-repositories-into-one-preserving-the-git-history-4e20d3fafa4e]]
* creamos nuevo repo + primer commit (no ''remote'' necesario en este momento para este repo)
* añadimos el remote del primer repo que queremos fusionar:git remote add -f first_repo `link_to_first_repo`
git merge --allow-unrelated-histories first_repo/master
* ''-f'' hace que haga un fetch inmediatamente (With -f option, git fetch is run immediately after the remote information is set up.)
* ''--allow-unrelated-histories'' permite saltarse la restricción **fatal: refusing to merge unrelated histories**
* separar en carpetas si necesario, corregir conflictosgit merge --continue
* repetimos para otros repositorios que queramos fusionar