LiJung LiJung - 2 months ago 6x
Git Question

Delete a folder in github, but not in local

I know that if I want to ignore folder that I don't want to push to Github. I could use

to ignore it.

Now my situation is I had pushed the folder up to Github, now I wish I could ignore it and delete it on Github, but still want the folder in local side.

How could I achieve it?


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.