0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

複数の git リポジトリを統合する

0
Posted at
  • マージ先リポジトリ作る
  • マージ元リポジトリ作る
  • 適当にそれぞれでコミットする
  • 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_a
    • git co -b merge_a repo_a/main
    • mkdir repo_a
    • git mv README.md repo_a
    • git mv src repo_a
    • git 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.git
    • git fetch repo_b
    • git co -b merge_b repo_b/main
    • mkdir repo_b
    • git mv README.md repo_b
    • git mv src repo_b
    • git commit -m "locate files of repo_b to repo_b dir"
    • git co main
    • git 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

スクリーンショット 2025-12-29 13.45.48.png
スクリーンショット 2025-12-29 13.46.36.png
スクリーンショット 2025-12-29 13.47.56.png
スクリーンショット 2025-12-29 13.48.06.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?