Solution 1:

Assuming you used the brew reinstall git command instead of brew install git, and assuming you still have Command Line Tools installed, then I would first install gettext and pcre2 as git needs them.

So, first do...

brew reinstall gettext

...followed by:

brew reinstall pcre2

and then by...

brew reinstall git

If that doesn't work you could try all the commands again but with install instead of reinstall.

And if that doesn't work, what's the result of brew config?

Solution 2:

I have an M1 so I had to install xcode-select first because reinstalling gettext or pcre2 was not running either.

Do it in this order:

xcode-select --install
brew reinstall gettext
brew reinstall pcre2
brew reinstall git

Good Luck!