We use .gitignore
file to untrack certain folder and/or files to the remote repository. However sometimes you have some files already pushed to your remote repository. Now you want to only keep them locally, so here is how to remove them from the remote repository.
Commit all your changes
Make sure all your changes beforehand are committed before proceed.
Remove Cached Folder or File
rm
- remove-r
- recursive removal (if it's a folder, files within it will also be deleted)-cached
- only remove files in the cache, not the actual files<path/file.ext>
- path of the folder or files you want to delete, e.g.assets/password.md
Commit
Push
Push the changes to your repository to see the changes effective there as well.