Delete a folder in github, but not in local
In order for you to remove the folder or file from Github but no from you computer use this command in the following order
- git rm -r --cached
name-of-the-folder
- git commit -m
"insert your comment inside this quotation marks"
- git push origin
in case you have several branches
you can do
- git push origin
master
- git push origin
branchName
EXAMPLE
git rm -r --cached .vscode
git commit -m "removed the .vscode folder"
git push origin
It seems like the --cached
option of git rm is what you want.
git rm --cached fileToDelete
git commit master
git push origin master
Now add the file to .gitignore
Not tested though.