Search code examples
gitmagentothemesgit-submodules

Can I add a GIT submodule to the existing project`s root, where files are not joint?


For example, I have Magento project:

app/design/frontend/base/
app/design/frontend/default/
errors/default/
errors/local.xml.sample
...
skin/frontend/base/
skin/frontend/default/
...

... and external Theme for it:

app/design/frontend/[theme name]/default/
errors/[theme name]/
errors/local.xml.[theme name]
skin/frontend/[theme name]/default/
README.[theme name]

But when I try to add theme`s repository as submodule to the root of project ...

$ git submodule add -b theme_name git://theme_repository.git .
'' already exists in the index

Is there any solution?


Solution

  • You cannot add the content of a submodule in the current directory (already versioned, hence "already existing in the index").
    You would need to use:

    git submodule add -b theme_name git://theme_repository.git aDirectory
    

    aDirectory would be a new directory not existing yet, and created to be the root folder of your submodule.

    You can then add symlinks to that new folder, in order for app/design/frontend/[theme name] or skin/frontend/[theme name] to renference the right folder.