MployBy
MployBy

Reputation: 127

Git deploy hook not deleting deleted files

Guys i use git to deploy changes to the live server.

Set up is bare repository outside of html folder with with following hook:

#!/bin/sh
GIT_WORK_TREE=/var/www/html git checkout -f

It updates changed files and creates new files, but it does not delete the deleted files.

How can i solve this?

Upvotes: 0

Views: 345

Answers (1)

Amber
Amber

Reputation: 526813

Add this at the end:

GIT_WORK_TREE=/var/www/html git clean -df

The git clean command is used to remove untracked files from a working directory; -f is required for it to do anything, and -d will make it remove untracked directories as well rather than leaving them empty.

Upvotes: 1

Related Questions