how to delete file from git command

C++
git rm --cached file1.txt
git commit -m "remove file1.txt"git rm file1.txt
git commit -m "remove file1.txt"
Source

Also in C++: