git – How to work with dev and production?


Hello everyone !

Dear Git experts , please explain how to work with git correctly.

Task: developing the site on the local machine and then pushing the changes to a remote repository.

What is now: a local project under version control (a git repository, it contains twenty commits), there is a server (hosting) with an empty git repository.

What was done (experiments): I tried to make a build branch (aka production), merged the necessary files for the site there, pushed to a remote repository, then made a pull from a remote repository – the files were pulled up. But so, apparently, he did not fully understand what the salt was. For when I continued to work on the project (master) and then poured the main development branch into the build branch, there were a bunch of merge errors and nothing worked out in the end.

As I see development: there is a main branch (master), development is underway in it. There is a production branch, also known as build. In the production branch, development is not carried out, but only the necessary changes from the Master are accepted. When changes need to be made to the site, a commit is made. This commit is then pushed (???) onto the build branch. After that, the build branch is pushed to an empty remote repository. And pull is done from it to the working site (also under version control). Something like this…

Please do not judge strictly, because there is little experience, and do not pour "water".
Thank you in advance for a good answer-explanation!


Unlike 99% of the git questioners here, you are doing everything right. Figure out why you have errors when merging master in build, and life will sparkle with new colors.

Scroll to Top