Pull/clone subfolders from repo1 to repo2

I have two public repos/projects and want to clone/pull only part of repo1 into repo2.



www/data folder of the new project (so same place…)

I have read about submodules, but in this case, it will pull into another folder.
I will not push into the repo1, only pull.
Is this possible? if not - can you give me some idea how I can do this :slight_smile:

thank you !

You can clone repo 1 and then update origin with the URL of repo 2 (git remote set-url origin ). After it, you do git pull origin main (or whatever branch you want). Then you build your desired structure locally and if you’re done, you add, commit and push it

Thank you @Zerotask ,
Ok, but in this case, if I want to pull from the first repo, do I have to change again the origin and pull from it?
or I am wrong.
with submodule, it will go to another folder. perhaps it is not possible for me to do what I want :thinking:

Yes, you have to switch back the the remote url from repo 1 then. This will work although it’s unusual and I don’t recommend it.
You can also work with 2 standalone repositories and then just copy & paste it. This is probably the best way to “merge” it.