Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git + deploy to production

Tags:

git

I'm fairly new to git and was wondering best practices when deploying to production? I have a master branch which always has the latest version of the code for production. When I goto production (for now I do it manually), I type git pull and get the latest. But it tries to merge the code, and sometimes it creates conflicts, etc. Is there a way for it to force it to take whatever is in the master branch as is?

I tried reading much on this including:

Best solutions to deploy from git to production?

http://posheika.net/?p=136

like image 944
KVISH Avatar asked May 01 '26 12:05

KVISH


1 Answers

Try to use git fetch origin and git reset --hard whatever_deployment_branch_you_use instead of pulling.

That will make the repository not try to merge the code, so you will avoid conflicts on the server.

like image 90
Frost Avatar answered May 03 '26 05:05

Frost



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!