L
L
Lev Rozanov2022-03-03 12:25:50
git
Lev Rozanov, 2022-03-03 12:25:50

How to work in parallel with the project and then merge into one?

There is a website running on PHP and MySQL and hosted on shared hosting. There are users on the site, there is a small but constant traffic.

Suppose the task is set - to register users by e-mail, and by phone number with confirmation by SMS.

As I see it now (I understand that it is wrong):
1. I make a copy of the files and the database
2. I deploy a copy of the site separately
3. I make the necessary changes and mark the files and tables that were affected (again, I will mark in a kind log, something like "Account.php file, lines 500 to 600" (I think this should be done through Git somehow, but I don't know how).
4. After I have made and tested all the changes, I transfer only the changed files to the working project and check it there again.

It seems to me that now it's all done much easier and more automated. Moreover, I am working on the project alone, and if there are suddenly several programmers with different tasks. Those. working with Git in a team during the development process, I understand that everyone works in their own branch and then everything merges into one, but when the project is one and at the development stage, I don’t understand how to deal with already working projects.

I work in PhpStorm.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
calculator212, 2022-03-03
@MetisKot

1) If you are working with git, then it is not clear why you need to make a copy of the files (db backups should generally be done without these reasons).
3) again, why mark them, git does everything, and if necessary, you can roll back to the previous version, or do you mean something else?
4) usually at such a time they just write technical work and at this time they test prod.
To be honest, I have a feeling that you know what github is, but you don’t know what git is.
upd: Here is an example of a commit with red marked deleted lines, green marked added lines https://github.com/PHPOffice/PhpSpreadsheet/commit...

D
Dmitry, 2022-03-10
@dlnsk

1. You need to install git on the host to push locally and then pull on the server to push the changes. If the hosting does not allow you to install git, then you can use the git-ftp plugin (transfers changed files via ftp)
2. You can make a copy of the database, but from some point it becomes too expensive, and you will have to look for the combination of data you need. This is solved by filling the database with test data (look for seed in the search). Developing the project, you supplement the seeders. This allows you to keep the database in its current form, as well as (!) roll back to previous versions and generate a database for this particular version there. In addition, seeders make it easy to experiment, because. database re-creation takes seconds.
3. To change the structure of the database, migrations are used. This is a description of which fields, tables, indexes are added / removed, as well as data transformation. Once you create the migration locally and test it on local data, you transfer it with git to the server just like all the rest of the code. It remains only to run the migration on the server and your database will be transformed as you indicated.
Of course, a lot depends on which framework you use. The vast majority allow you to create both seeders and migrations.
To make it easier to imagine, here is a link to the Laravel documentation on this topic: https://laravel.com/docs/8.x/migrations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question