A deploy replaces every file with the branch's contents, so anything edited on the server, a template changed in place or a template held as a virtual file (which resolves last anyway), is overwritten. Content is records and survives a deploy untouched; a layout's template path is content too. Keep template edits in the repository, and treat the branch as the only source of files on any environment.