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.

  • Multiple bitbucket accounts
  • Want to track a file / folder which was earlier ignored by .gitignore
  • Move code from Mercurial to Bitbucket
  • Git: How to connect SourceTree to my Git-Enabled-Web-Hosting via SSH?
  • How to review a pull request in intelliJ IDEA?
  • Cloning two bitbucket repo into a same folder
  • 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!

  • How to do git merge/pull correctly: You have not concluded your merge (MERGE_HEAD exists)
  • How to reliably check whether a file is ignored by git?
  • Git Merge some folder
  • MATLAB git by command window
  • How to include modified configuration files in a docker image?
  • How do you undo a mistakenly overwiten git commit message?
  • 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:

    Git Baby is a git and github fan, let's start git clone.