- マージ先リポジトリ作る
- マージ元リポジトリ作る
- 適当にそれぞれでコミットする
-
https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories
- あたり参考にマージしてみる
- subtree 使わない方が良さそう
- 統一後のリポジトリで全て操作したいため
cd ../repo_merge-
git remote add repo_a git@github.com:ieiriyuki/repo_a.git- リポジトリA を取り込む
git fetch repo_agit co -b merge_a repo_a/mainmkdir repo_agit mv README.md repo_agit mv src repo_agit commit -m "move repo_a files to repo_a dir"git co main-
git merge --allow-unrelated-histories merge_a* efe1142 (HEAD -> main) Merge branch 'merge_a' |\ | * 4b9e6d8 (merge_a) move repo_a files to repo_a dir | * a225c5c (repo_a/main, repo_a/HEAD) main.py | * 9b67e7b Initial commit * f0ad454 (origin/main, origin/HEAD) first commit * a3870b3 (repo_b/main, repo_b/HEAD, merge_b) lib.py and main.py * 9324e9e Initial commit git push origin main
-
git remote add repo_b git@github.com:ieiriyuki/repo_b.gitgit fetch repo_bgit co -b merge_b repo_b/mainmkdir repo_bgit mv README.md repo_bgit mv src repo_bgit commit -m "locate files of repo_b to repo_b dir"git co maingit merge --allow-unrelated-histories merge_b
* d5d3954 (HEAD -> main, origin/main, origin/HEAD) Merge branch 'merge_b'
|\
| * 826916b (merge_b) locate files of repo_b to repo_b dir
| * a3870b3 (repo_b/main, repo_b/HEAD) lib.py and main.py
| * 9324e9e Initial commit
* efe1142 Merge branch 'merge_a'
|\
| * 4b9e6d8 (merge_a) move repo_a files to repo_a dir
| * a225c5c (repo_a/main, repo_a/HEAD) main.py
| * 9b67e7b Initial commit
* f0ad454 first commit



