Git deletes remote server files while retaining local file instance details

  • 2020-06-07 05:55:15
  • OfStack

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"
git push

1. Delete the server file and keep it locally


git rm --cached useless.log
git commit -m "remove file from remote repository"
git push

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"
git push

Thank you for reading, I hope to help you, thank you for your support to this site!


Related articles: