Remove an added file before to make the commit

Modern approach (Git 2.23+):

git restore --staged filename.txt

Traditional approach (works on all Git versions):

git reset HEAD filename.txt