S
S
suhuxa12017-07-23 10:48:46
git
suhuxa1, 2017-07-23 10:48:46

How to connect local development and hosted project via git?

I decided to switch to git, created a repository in bitbucket, linked it to my local project - everything is ok. Now the question is how to make a production version on hosting (there is a git (beget))? Those. it should be something like this: I make changes on the localhost, make a commit, and the project is updated on the hosting, the changes are immediately visible. I read a lot of manuals, but due to inexperience, I quickly got confused. Some say on the hosting you need to make a clone, others that you need to make the following design there:

git remote add production
git commit -m "Комментарий к коммиту"
git push production <имя_ветки>

Actually, in this case, I don’t understand why make another commit. I already did one when I connected the project on the local.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander Varakosov, 2017-07-23
@thelongrunsmoke

The point is to separate developer and production branches. So that crooked commits do not break anything important.
At the same time, all the developed functionality is pushed to the developer branch (and is visible on the local copy), and, as needed, changes from the developer are merged into the production branch and rolled out to the server.

D
Dmitry, 2017-07-23
@Sad_Bro

if you are completely confused with academicism, then look towards jenkins or other tools for continuous integration. In a little more detail, this is a separate tool in which tasks are started, one of the tasks, for example, just deploys the code from the master branch (by changing in this branch) to the server.

W
wwarlock, 2017-07-29
@wwarlock

I think you should read the article about the branch model.
https://habrahabr.ru/post/106912/
And you should read it even if you are not using Git on the server.
From my point of view, Git in production is generally not a good practice, with some exceptions of course.
Better deploy via Jenkins or other CI/CD.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question