Answer the question
In order to leave comments, you need to log in
How to properly deploy applications with Git?
Good day to all!
At the moment, I use a very simple deployment option when the post-receive hook is triggered on the server and git checkout -f branchname is done in it.
Everything suits me, but here's the problem. If I create a file in the project, then when I deploy it, it appears on the site, but if I do git rm filename in the project, the deployment goes through, but the file remains on the server (which is logical, because we stupidly expand the current branch into a directory). So the question is - how to properly implement a deployment so that all files controlled by the version control system are added and deleted, but directories that are not under the control of the system remain on the server (for example, the /upload directory)
Answer the question
In order to leave comments, you need to log in
And thank you everyone!
I resolved the issue myself.
So the scheme is now as follows - when pushing to a remote server in the post-receive hook, here is the code
#!/bin/sh
git --git-dir ~/test/.git --work-tree ~/test/ pull
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question