Tracked deletions in git should be synced with the server upon deployment
Currently when using the git deployment feature, if you delete a previously tracked file and push this change to the server it doesn't delete the file from the server.
This means you're left with lots of legacy files that are no longer needed, and your repo is no longer in sync with your server files.
This can cause issues if you ever wanted to push changes back from the server to git as it would then track the previously deleted files and re-add them to the sever!
I'd assume this to be expected behaviour but there might be a reason if anyone wants to shed some light?
Thanks, Harry, for taking the time to report this.
I’d like to better understand your use-case in order to figure out what’s going on.
For example, if I have a git repository deployed on my server on Cloudways, and if I go ahead and delete an already tracked file from the repository on my local computer and push the changes upstream to the remote repository and then pull those changes on my Cloudways server, I do see that the deleted file is gone from my public_html/ (or any other deployment) directory. Are you having trouble with that?
Or is your workflow different from what I’ve described? Please let me know so I may check it thoroughly.
Justin Moh commented
Hi, this issue is very easy to be replicated -- might not the same, but close enough.
1. Deploy with your git repository
2. Push a commit
3. Pull the repository on Cloudways
4. `git reset --hard xxxxxxx` (you accidentally pushed credentials) and push the new commit
5. Pull the repository on Cloudways
6. Look in to the file content of that modified file : doomed.
Thanks for looking into my submission.
What you have described is what I'm hoping to do. When I was working on a site recently I found this wasn't the case. I made a support ticket about it to confirm it was expected behaviour and they said it was and that I could make a feature request here.
Maybe it could have been a permissions issue on my end but I'm confused as support said this was intended.