DEV Community

loading...

How to remove files from git?

Badri
・1 min read
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.

Discussion (0)