Git deletes remote server files while retaining local file instance details
- 2020-06-07 05:55:15
How does Git delete remote server files while retaining local files
When uploading projects to git, it is sometimes unreasonable to delete the local eclipse configuration files and then synchronize the server. git provides a good solution to delete server files without affecting local files, as shown below
git rm --cached filename/-r directory
git commit "xxxx"
1. Delete the server file and keep it locally
git rm --cached useless.log
git commit -m "remove file from remote repository"
At this point, github no longer exists
2. Delete the remote useless folder and keep it local
Note that the -r parameter is used to delete the folder
git rm --cached -r useless
git commit -m "remove directory from remote repository"
Thank you for reading, I hope to help you, thank you for your support to this site!