Git submodule without own folder

I want to do some parts of my projects, for example, my external jQuery plugins. For this, I studied submodules. They seem completely perfect because they can be managed and updated in one centralized place. My only problem is that they are cloned to a folder. That leaves me with such a structure.

/js /plugin_one plugin_one.js /plugin_two plugin_two.js 

What I want is more like this.

 /js plugin_one.js plugin_two.js 

Is this possible with submodules or am I using the wrong tool?

Greetings.

+3
source share
1 answer

Submodules are great for combining multiple repos into a fixed configuration set (i.e., SHA1, which is a fixed set of each of these submodules recorded by their parent repo)

However, they are always cloned in their own directory.
And they have a lot of other gotchas (see " Why Your Company Shouldn't Use Git Submodules )."

One way around this is to support 2 different sets of working trees:

One of them is not supported by versions, along with all files. One with repositions usually cloned (i.e. with submodules in their own directory).

You can do this all the usual action, but with:

  • --git-tree for each Git command, --git-tree pointing to the first set (the one that has the whole file)
  • quite fully .gitignore , capable of ignoring any file that is not part of their specific repo.

This is not very satisfactory, and indicate that the submodules (even in other VCS that offer them - Hg and subrepos, ClearCase and UCM component, ...) should be separated.

Thus, sharing a jQuery plugin may first include a bit of rethinking file organization to see if these files can really be considered a β€œsubmodule”.

+1
source

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


All Articles