Reputation: 809
Pretty new to git, I wanted to check if my process is reasonable, and ensure that my deployed production web server only ever sees the master repo.
I have an "origin" repo on bitbucket. I've cloned it to my development server where I'm doing most of my work. To get changes into production it goes like this:
On development server:
make changes
git commit -am 'message'
git push # to bitbucket
On production server:
git pull # from bitbucket
On the production server I've got a post-merge hook that does a checkout to send it to the /www directory, and also change a couple of settings (turn off debug, etc).
Is this a normal way to do this? If I work on extra features in separate branches on my development server and push those to bitbucket, do I need to worry about my production server "accidentally" picking those up on a git pull and/or checking them out? Does git pull only do "master" unless otherwise told? Ideally I'd like the production server to only ever see "master", but I want other branches on bitbucket so other people can see the code I'm working on.
Upvotes: 2
Views: 73
Reputation: 25383
git pull
is a two-step operation:
HEAD
is pointing toThere's a lot to grasp in those two steps, but I think I can make this easy.
On your production server, run these two commands whenever you want to update:
git checkout master
git pull origin master
This way only the changes pushed to your master branch will be deployed.
Upvotes: 2