So I want to add our git repo to the server so that we can pull in the latest changes from the master branch and easily update the live sites via SSH.

I don't want changes tracked by Git on the live site though, I want it to only be able to pull in new changes from the master branch as new features will be developed on local machines and reviewed for QA on staging sites prior to the production server being updated.

What is the best way to achieve this? Is there also a way to exclude certain files from being pulled in from the repo on the production server?

For an example, we version control our gulp files for concatenating scripts/styles, but this does not need to be pulled in on the live site/production server.

1 Answer 1


You need to add a build step to your deployment. Use a build server to take the files from the source repository and push them to production. The build server can run the Gulp process, and filter out the files you don't want to push to production.

You say you don't want to track changes in production, but it's not a bad idea. Your build server can push the files it wants to deploy to a second repository for deployment. Then your production server can pull changes from that deployment repository. If you ever need to roll back, you can revert your deployment repository.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.