Providing custom files for the git submodule

My project uses Varying-Vagrant-Vagrants as a submodule in /machine .

VVV offers the ability to customize it through user files. My user files:

 machine/ β”œβ”€β”€ Customfile β”œβ”€β”€ config β”‚  └── nginx-config β”‚  └── sites β”‚  └── mysite.conf └── www └── mysite β”œβ”€β”€ vvv-hosts β”œβ”€β”€ vvv-init.sh └── wp-cli.yml 

These paths are ignored in the VVV .gitignore file.

What a good way to provide these files in my project so that they sit in the same directory as vvv when the entire project is cloned recursively? Hope you don't have to make a fork that keeps track of these files.

Simply adding a submodule with these files has the following result:

 $ git submodule add https://github.com/Varying-Vagrant-Vagrants/VVV.git machine/ 'machine' already exists and is not a valid git repo 

thanks

+6
source share
1 answer

From git help submodule ,

Submodules allow you to implement external repositories inside the selected subdirectory of the source tree, always pointing to a specific commit.

Your call to git submodule add complains because you are trying to embed an external VVV repository in the machine subdirectory, which, as the message says, already exists and is not a valid git repo.

To get the desired directory structure, with machine as a subdirectory of the VVV directory, you will need to have your repo as its submodule, and not vice versa.

With that in mind, I don’t see how you could get one git clone to pull both repositories and organize them as you wish. The next best thing would be for your repo to pull out the VVV repo as a submodule / subdirectory parallel to your machine directory and include a script to establish a symbolic link to machine from the VVV subdirectory.

0
source

Source: https://habr.com/ru/post/973295/


All Articles