To remove a file from the Git repository but not delete it from your filesystem, execute the following:
1 2 | 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:
1 2 | git rm file_to_delete.txt; git commit -m "Removing and Deleting file_to_delete.txt" ; |
This post is also available in: Greek