Using Git to deploy changes to server
I have read through the posts here and I have not found one that has a great explanation for what I am looking for. So, here it goes….
I am developing a WordPress site locally. I commit changes and then I push them to Bitbucket. Once I do that, I go to my server and want to have all of the changes reflect on that server, even if there are changes on the server. I have tried various things and I cannot get this to work correctly. I have tried
git fetch and none of the changes are reflected. It says
-> FETCH_HEAD instead of
HEAD, which may be an issue.
What is the best way to do this so that the changes are always reflected on my server, even if there are changes on the server? I want to overwrite what is on the server. Thanks for your help!
2 Solutions collect form web for “Using Git to deploy changes to server”
If you only want your files from your repo then make a
git checkout . to revert all your modified files on your server and then pull your changes.
If you have a deployment system like Jenkins you can define a stack of command that should be executed on deployment.
Assuming that you are FTPing the files to your server, you might want to try git-ftp: https://github.com/git-ftp/git-ftp/.