If a file already committed and pushed into your github repo. And you forgot to add in .gitignore and make your push. Then you can ignore that file by ( make sure you add that file name in .gitignore
) -
Remove the files from the index (not the actual files in the working copy)
git rm -r --cached .
Add these removals to the Staging Area
git add .
git commit -m "your commit message"
Voila 🐌
Top comments (2)
This might actually be the first git CLI command I'll ever learn. This happens to me quite often, and I find myself doing the deletion, committing/ignoring/comitting path all over. Thanks!
You are most welcome.
I'm glad you found this useful 😀
Please keep in touch for more 🤝