E
E
EazyE2015-08-26 17:18:32
git
EazyE, 2015-08-26 17:18:32

Working with git when the project is running on a simple hosting. How to properly organize branches?

Good afternoon!
Can you please tell me how to properly organize branches in git?
The situation is this. I am using Laravel framework in my project. It has a well-known and simple directory structure (approximately, since the details are not particularly important here, the structure is the same for almost all frameworks):

  • app
  • bootstrap
  • public - folder with index.php
  • ...
  • other folders and files

But on the hosting itself, such a directory structure for this site is organized:
  • some folder created by hosting 1
  • some folder created by hosting 2
  • some folder created by hosting 3
  • site_app - directory with Laravel system directories (app, bootstrap, ...)
  • www - directory with public content, the name www was not invented by me, it is impossible to change

Previously, I copied the changes via FTP and made such a structure (namely, I decided to store everything in site_app, which was not in the public folder before). Naturally, there are a lot of disadvantages, starting with the fact that in www/index.php you need to change the paths to site_app, ending with a corny inconvenient method for making updates. And I want to go stupidly via ssh and do a git pull.
But how to do that?
You can create a branch called, say, master_hosting, merge the develop branch there, change it to the "hosting structure", commit, and then do a git pull on the hosting.
But I really liked the approach described in this article habrahabr.ru/post/106912/.There, the meaning is that after the changes we make a release-xx branch from develop, we can change something in it (at least readme.txt, and maybe small bugs), commit, merge in master and develop (which could have changed already , so we fix the conflicts). Apparently it is assumed that we pull master then where it should be and rejoice.
What to do in my case? Apparently, the algorithm for adding a new feature to the project is as follows:
1. Create a my_feature branch from develop
2. Add functionality
3. Commit
4. Merge with develop
5. Create a my_release branch from develop
6. Change readme.txt and / or something else there
7 8. Commit
with master and develop
9. Create hosting branch from master
10. Making changes to the directory structure.
11. Commit
12. git pull from hosting.
But it seems to me that something is wrong, it's not quite beautiful ... Tell me, how are you doing? Or maybe in general I think not quite right, correct your thoughts)

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
D', 2015-08-26
@EazyE

Why such a perversion with branches?
I usually do ln -s laravel/public /path/to/www
That is, in fact, www now refers to laravel's public folder and there are no problems with changes. Also, the folder with the project itself can be stored anywhere.

A
Anton Radushevsky, 2015-08-26
@doromones

can look towards capistrano?

P
Philipp, 2015-08-26
@zoonman

На мой взгляд удобнее арендовать VPS и настроить непрерывную интеграцию. Немного болезненно в начале, но никакого шаманства и треша в управлении версиями потом. Если ваш проект удачный, то он будет развиваться и обычного хостинга вам сразу перестанет хватать.
В текущем случае можно сделать что-то вроде этого stackoverflow.com/questions/327417/using-capistran...

A
Alex Black, 2015-12-17
@s37dap42x

Чтобы каждый раз не коннектиться к серверу и не делать каждый раз пул-реквест, можно настроить это автоматом. Я использую для управленя серверами вот эту штуку https://forge.laravel.com/ - рекомендую, кстати.

Павел, 2016-03-23
@pbt39

Нашёл этот вопрос решая ту-же проблему.
Я думаю чуть в другую сторону.
Буду исходить из того, что там (на хостинге) нету git.
Думаю делать rsync в локальную директорию, а уже её обрабатывать с помощью git.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question