L
L
Leonid Markov2018-04-02 17:55:58
git
Leonid Markov, 2018-04-02 17:55:58

Where should I place the .git folder in Bitrix projects?

I found the following options:
1) In the folder /local/
local/
templates/
modules/
components/
.git/
2) In the root of the site
./
bitrix/
upload/
o-kompanii/
...
index.php
.git/
3) Above the folder with the site.
For example, the Bitrix files are in the /var/www/user/data/www folder, and the .git files are in the /data/ folder.
In the first case, I save only my developments by modules, components, and templates.
In the second case, I can save static content: "about the company", "delivery", "Contacts", save the component settings in the /catalog/, /news/ folders. And everything that is not needed, add to gitignore.
The third option seems to be the same as the second.
Please share your practical experience on how the file structure of the project is organized.
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
eternalfire, 2018-04-02
@eternalfire

You don’t need to create .git, everything happens automatically after executing the command in the git init console
, but in .gitignore I would advise adding the Bitrix core and the upload folder

L
lexnekr, 2018-04-04
@lexnekr

It all depends on your strategy and your project.
1. If the site is small, then I usually place it in the root of the site. In gitignore I make upload, as advised above.
2. From a security point of view, it makes sense to initialize one level higher. To 100% exclude access to repository files. Of course, you should limit access at the web server level anyway, but we understand that it’s better to lay straws
3. If the project is large, it can be multi-site, then sometimes it makes sense to create several repositories. Here are possible options:
3.1 The project is large, but 1. Then it makes sense to make submodules for /bitrix/, /local/ in the project, sometimes individual modules in them...
3.2 Если проектов много (многосайтовость) с 1 общим ядром, то я обычно делаю полноценный репозиторий в ядре (/bitrix/), и по репозиторию в публичке, где исключаю /bitrix/ через gitignore.
P.S. Недостаток держать ВЕСЬ /bitrix/ в репозитории в том как будут происходить обновления. После них будут следовать горы файлов в коммит. И такой коммит фиг откатишь (т.к. при обновлении БУС затрагивается ещё и БД), именно поэтому выше вам рекомендовали убрать его из репы. Но т.к. иногда в этом каталоге есть и свои файлы (как модули, так и какие-то правки ядра), то бывает потребность всё же делать как я описал.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question