meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
git:split_merge_repos [2024/01/13 21:01] niziakgit:split_merge_repos [2024/01/17 11:48] (current) niziak
Line 21: Line 21:
 Then modify file location of repo BBB to be in desired path and merge it into repo LLL. Then modify file location of repo BBB to be in desired path and merge it into repo LLL.
 <code bash> <code bash>
 +
 +######### WAY 2
 +# Clone RRR repo temporary to change all file paths to new repo.
 +cd tmp
 +git clone http://URI_to_RRR_repo
 +git checkout main
 +# now move files from remote repo RRR into correct path:
 +mkdir app_RRR  # create new location path (which will be merged to destination RRR repo)
 +git checkout -b branch_change_file_location
 +git mv -k * app_RRR/src
 +git mv src app_RRR/src
 +git mv .gitignore .gitlab-ci.yml .gitmodules app_RRR/src
 +
 +git commit -m "location of app_RRR adapted to local repo" 
 +
 +# optionally reword all commits:
 +git rebase --root -x 'git commit --amend'
 +
 +cd LLL_repo
 +git remote add RRR /tmp/cloned_RRR_repo
 +git fetch RRR
 +git merge RRR/branch_change_file_location --allow-unrelated-histories
 +######### WAY 2 END
 +
 +######### WAY 1
 git remote add RRR http://URI_to_RRR_repo git remote add RRR http://URI_to_RRR_repo
 git fetch RRR git fetch RRR
-git checkout -b branch_change_file_location RRR/master+git checkout -b branch_change_file_location RRR/main
  
 # now move files from remote repo RRR into correct path: # now move files from remote repo RRR into correct path:
Line 35: Line 60:
 git merge branch_change_file_location --allow-unrelated-histories git merge branch_change_file_location --allow-unrelated-histories
 git commit git commit
 +######### WAY 1 END
  
 # cleanup # cleanup