0

I would like to setup git for a website taking the following into account:

I have a VPS setup where I plan on doing the following:

  1. Setup /home/site/public_html (Main Website)
  2. Setup /home/dev-site/public_html (Dev Site)
  3. Use an IDE on my Windows PC to make changes.

I would like to see the following happen:

  1. I make changes on my local PC
  2. Push to my DEV site (dev-site) for testing
  3. If everything works there, I would then push to my Main Website(LIVE)

What is the best approach to have something like this work.

I just now started to use GIT and it is getting a little confused.

4

1 回答 1

1

Assuming you are using a central repo for your code (github, gitlab ect..)

Create two branches in git (master & dev)

Always checkout the dev branch for your work. (Never master)

windowsComupter$ git checkout dev

When you are happy with the results, upload your commit

windowsComputer$ git commit
windowsComputer$ git push 

On your development site, pull down the latest dev repo

dev-site$ git pull origin dev

When you have tested everything, merge dev into master

windowsComputer$ git checkout master
windowsComputer$ git merge dev

Go to your production site, and checkout the latest master

productionServer$ git pull origin master

Let me know if that doesn't answer your question and I'll expound further.

于 2013-03-31T16:02:20.620 回答