GIT add a repository as a folder of an exiting

From Luniwiki
Jump to: navigation, search

Add remote repo URL to existing one

git remote add -f <BRANCH> https://<USER><OTHER_REPOSITORY>


git remote add -f EDI271Parser
Updating EDI271Parser
Password for '':
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.
 * [new branch]      master     -> EDI271Parser/master

Merge remote as a branch

git merge -s ours --no-commit --allow-unrelated-histories <BRANCH>/master


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


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 '':
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.
  dc7f89a..42c1be3  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.


Daniel Simao (talk) 13:52, 12 February 2019 (EST)