I have a VPS running a Node.js / React app.
I want to update the files in the vps each time I push data to the git(hub).
I found out, using this answer, that I can add some hooks in git, executing commands on "post-receive".
What I didn't quite understand :
Why did he init another git ? Couldn't he have done this in the .git directory and create the hooks/post-receive file?
Why
git checkout -f
? If the goal is to update local files, so nodemon / create-react-app restarts the server / app, why not execute agit pull
instead ?Is there a better way of doing this ?