Component based web project directory layout with git and symlinks

前端 未结 1 1057
滥情空心
滥情空心 2020-12-06 19:13

I am planning my directory structure for a linux/apache/php web project like this:

Only www.example.com/webroot/ will be exposed in apache



        
相关标签:
1条回答
  • 2020-12-06 19:58

    As soon as you need to reuse some set of files elsewhere, that's when you should start thinking in term of components or (in git) submodules

    Instead of managing webroot, and comp, and lib within the same repo (which is the SVN or the "Centralized way" for CVCS), you define:

    • n repos, one per component you need to reuse (so 'img' would be a Git repo reused as a submodule within webroot, for instance)
    • a main project for referencing the exact revision of those submodules you need.

    That is one of advantages of submodules of symlink: you reference one exact revision, and if that component has some evolutions of its own, you don't see them immediately (not until you update your submodule anyway).
    With a symlink, you see whatever state is the set of files at the other end of that link.

    0 讨论(0)
提交回复
热议问题