0

How to convert automatically all symlink to git submodules in some repo.

I want to do something like, I have on client side:

folder1(repo1) 
| 
+--folderA--file.a 

folder2(repo2) 
| 
+--symlink to folderA 

And I want convert it to git submodule, on server side:

repo1 
| 
+--FolderA--file.a 

repo2 
| 
+-- git submodule to folderA in repo1.. 

Repo 1 and repo 2 are mine.

(I need something like:

I have on client side folder1 inicializated as repo1, I have folder2 inicializated as repo2, I have symlink from one folder in folder 2 to one folder in folder1. And I need it on server side (git server) all symlinks convert to git submodules -> folder in repo2 to be submodule to folder in repo1.)

(sry for my English), I'm using google translator, and it sometimes translate very bad.

  • Hello. It would help people better understand your question if you explain your question, mention your efforts so far and describe what you intent. Please take a look here on [how to ask a good question](https://stackoverflow.com/help/how-to-ask). – Pejman Dec 25 '17 at 17:24

1 Answers1

0

You cannot automate that, unless you know the remote repo URL those symlink are supposed to point to.

If you do, delete the symlink, and type:

git submodule add ../path/to/other/repo/.git otherRepo

But in your case, that would clone repo1, not folderA

repo2
|
+ repo1
  |
  + folderA

If you intent to make commits from repo2/repo1/folderA and push back, it is best to reference a bare repo version of repo1 (a repo1.git)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250