Removing Files and Folders From Git Version Control

The problem: I often forget to add files or folders to a project’s .gitignore file. Here’s how to stop Git from tracking files and folders.

For a file:

git rm --cached <file-name>

For a folder:

git rm -r --cached <folder-name>
Tags: