DEV Community

Badri
Badri

Posted on

How to remove files from git?

git rm filename
Enter fullscreen mode Exit fullscreen mode

If you need to remove a file from git but not from local repository. Use

git rm --cached filename
Enter fullscreen mode Exit fullscreen mode

Do not forget to add the file to .gitignore if that file would be created again.

Top comments (0)