Answer the question
In order to leave comments, you need to log in
How does git work?
Hello. Guys, tell me, please. I can't figure it out.
I have hosting on the run. It also has a small Wordpress site.
Git connected.
I have a github repository with the files of this site.
There are 2 branches master and dev.
So I want to give the site for revision to a third-party person, I want it to be done on the dev branch until I check it and put it into production myself.
How to work with git? Is it necessary to create a copy of the site? Is there a copy for each branch? How does the database work in this case. If changes were made to the database on the test site, will it need to be somehow connected to the main database? Is it possible to somehow work on several branches, but at the same time that the site was one? Suddenly I will have 10 branches. Is it for all 10 branches I will need to create a copy of the site? 10 copies?
Answer the question
In order to leave comments, you need to log in
The git will not do any magic for you. You need to configure everything yourself and define development processes.
For example.
The main copy of the turnip is located on the gihab (gitlab, bitbucket, on your server).
Here the master branch is protected from pushes and commits. Let's say pushes and commits are allowed only for the maintainer.
The production site is under the git, and pulls the code from the master from the master copy.
Additionally, dev.site.ru is deployed. The turnip is also cloned there, switched to the dev branch. git checkout
dev The maintainer checks, merges, pulls to production.
The database is deployed separately for dev and prod.
Migrations are used to version the database structure. To fill with data - seeds.
Those. to apply the latest developments, the code from the turnip is first pulled, then migrations and seeds are launched.
Well, it is not necessary to develop directly on the dev server.
You can clone a turnip on your computer, do what you need, push it to the dev branch, then pull this branch to the dev server for testing. Then smerzhit and pour on prod.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question