Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git submodules: ln -s

How can I create a directory link that will survive git submodule update?

Given the following example directory structure:

proj
|-- lib3
|   `-- submod
|       `-- lib
`-- lib

I created a soft link from proj/lib/ to proj/lib3/submod/lib using something like the following command:

brad@bradpc:~/proj/lib$ ln -s ../lib3/submod/lib submodlib

creating the following directory structure:

proj
|-- lib3
|   `-- submod
|       `-- lib
`-- lib
    `-- submodlib

However, running git submodule update destroys my link. I was under the impression that a soft link is a logical link to a relative path, so removing the object and re-adding it would keep the link intact. How can I achieve the desired effect?

like image 354
brad Avatar asked Sep 26 '26 00:09

brad


1 Answers

A soft link made with ln -s should behave like you intended. As I understand it, if you do a git submodule update some part of your directory proj/lib3/submod/lib gets deleteted and recreated. That means there's no difference in that, than manually do a rm proj/lib3/submod and after that a mkdir -p proj/lib3/submod/lib for example.

I tested this manually (rm and mkdir) on my openSuse Linux installation and the soft link was still fine after recreating the directory structure.

In which OS enviroment do you work? Perhaps it's not a true softlink.

like image 117
nulldevice Avatar answered Sep 28 '26 16:09

nulldevice



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!