Details

Remove Accidentally Committed File from Git

We've all done it before, accidentally committed a file we shouldn't

Add the file or folder to .gitignore

Remove the tracked file or folder from git working directory
by running the following command

git rm -r --cached <name of file>

Commit the changes

git commit -m “Remove bin and obj folders from tracking”

Push the changes

git push origin main

This will ensure that the file or folder is ignored by Git and won’t be included in future commits.