GIT add a repository as a folder of an exiting
Contents
Add remote repo URL to existing one
git remote add -f <BRANCH> https://<USER>@git.luniel.com/git/<OTHER_REPOSITORY>
i.e.:
git remote add -f EDI271Parser https://dsimao@git.luniel.com/git/EDI271Parser.git Updating EDI271Parser Password for 'https://dsimao@git.luniel.com': warning: no common commits remote: Counting objects: 218, done. remote: Compressing objects: 100% (111/111), done. remote: Total 218 (delta 40), reused 218 (delta 40) Receiving objects: 100% (218/218), 154.43 KiB | 30.89 MiB/s, done. Resolving deltas: 100% (40/40), done. From https://git.luniel.com/git/EDI271Parser * [new branch] master -> EDI271Parser/master
Merge remote as a branch
git merge -s ours --no-commit --allow-unrelated-histories <BRANCH>/master
i.e.:
git merge -s ours --no-commit --allow-unrelated-histories EDI271Parser/master Automatic merge went well; stopped before committing as requested
Create a folder from the branch
git read-tree --prefix=<FOLDER>/ -u <BRANCH>/master
i.e.:
git read-tree --prefix=EDI271Parser/ -u EDI271Parser/master
Commit and push changes
git commit -m "EDI271Parser folder added" [master 42c1be3] EDI271Parser folder added git push -u origin master Password for 'https://dsimao@git.luniel.com': Counting objects: 220, done. Delta compression using up to 2 threads. Compressing objects: 100% (113/113), done. Writing objects: 100% (220/220), 154.71 KiB | 154.71 MiB/s, done. Total 220 (delta 40), reused 218 (delta 40) remote: Resolving deltas: 100% (40/40), done. To https://git.luniel.com/git/InternalProjects.git dc7f89a..42c1be3 master -> master Branch 'master' set up to track remote branch 'master' from 'origin'.
References
Daniel Simao (talk) 13:52, 12 February 2019 (EST)