I got the same error on my vs code. Well this happens when you have initialized .git in a higher level folder.
Ways to solve it:
Through file explorer (windows/mac)
locate the folder that has the 10k commit issue on your file explorer
keep looking for .git folder in the parent folders
if found, delete the .git folder
Through VS Code Terminal (Hard Way)
open terminal in vs code using ctrl+`
first locate to your folder which has 10k commits issue eg: cd "C:/Windows/Deepanshu/Projects/IssueFolder"
once reached use command: cd .. (to go to parent folder) and the ls (to check the list of folders and files the current folder)
once the .git folder is found, delete it using the command: rm ".git"
(this is my first answer in stackoverflow, I hope it solves the problem)