Git: push and pull staging and production servers

I would like to consult git and push

/ pull

and try to circle around the correct flow.

I have a Master branch hosted on codebasehg.

So locally I work and commit and push.

On staging and production servers, I just want to pull as I will never work from these machines. Does this mean when I do pull

, he is going to ask me to merge conflicts? Like everything I want to do from servers, it needs to be compiled master

.

The second question is that the site he is working on is already finished for stage 1. As soon as at this stage I want to create a branch. Then with a branch, I want to test on a staging server before merging and going to production. Hope this is correct? So when creating a branch it goes to codebasehg when I do push

dev from me? If so, will I just post the branch to the staging server? After finishing and merging locally, after pushing and pulling from the staging server, will the branch on the staging server be merged as well?

I hope this makes sense and thank you for your advice.

+2


source to share


2 answers


Does this mean when I try? going to ask me to merge conflicts?

What conflicts? When everything you do in the repository is pulling and you never edit anything, how could you get any conflicts?

So when creating a branch it will be on codebasehg when I push DEV to me?



Of course, if you use the correct syntax:

# create a new branch locally
git branch name_of_branch
git checkout name_of_branch
# edit/add/remove files    
# ... 
# Commit your changes locally
git add fileName
git commit -m Message
# push changes and new branch to remote repository:
git push origin name_of_branch:name_of_branch

      

+2


source


  • if there were no changes in the local repository on your server, there will be no conflicts

  • you need to push the local branch to the repository, you will checkout the latest changes on the server



+2


source







All Articles