Monthly Archives: September 2020


Git: Remove or Delete file from Git repository

To remove a file from the Git repository but not delete it from your filesystem, execute the following:

git rm --cached file_to_keep.txt;
git commit -m "Removing file_to_keep.txt from Repository";

To remove a file from the Git repository and the filesystem, use the following:

git rm file_to_delete.txt;
git commit -m "Removing and Deleting file_to_delete.txt";