Make sure to remove those files from the index first:
git rm -r --cached src/.history/
Then check the status reported by VSCode: those files should not be there.
Note: the .gitignore rule should be
.history/
(no need for '*
': you ignore the just the folder, with the trailing '/
': that is enough)