Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is there a way to load non-editable/read-only git submodule?

the git command "submodule" downloads the whole source of the project AND it is editable...

is there a way to make the submodule read only?

I just want to have one of my git projects to be dependent on another, maybe submodule is not the correct way? what is a better/correct way of accomplishing this?

like image 297
iCodeLikeImDrunk Avatar asked Nov 08 '25 11:11

iCodeLikeImDrunk


1 Answers

This doesn't really answer your question, but I think you're looking for git subtree. Which is like git submodule, but better (and waaay better if you don't want push updates). Unfortunately, I don't think you can make it read only.

Taken from the example in the page above:

git subtree add --prefix [folder where you want the copy] [repo to clone] master --squash

for example

git subtree add --prefix .vim/bundle/tpope-vim-surround \
https://bitbucket.org/vim-plugins-mirror/vim-surround.git master --squash

The main benefit of subtree is that you don't need to run extra commands to download the rest of the code, as with submodules.

like image 61
Augusto Avatar answered Nov 10 '25 06:11

Augusto