I was trying out some sample instructions of git and came across this peculiar case that when we do a git rm *, it doesn\'t delete the .* files in
The wildcard gets expanded by your shell, and the expansion does not include dot files, by default, in most shells.
So by the time git executes, the first command has become
git rm -r folder testfile3
and the second probably a literal
git rm -r *
which git then expands by itself.
As remarked by Keith, to remove everything in one go, prevent the shell from expanding the wildcard so that git does the expansion the first time already. This can be done with double or single quotes, or with a backslash before the asterisk. I tend to prefer single quotes:
git rm -r '*'