Install older removed brew formula version
Solution based on Versions.html doc
To install a removed brew formula version, we can follow the suggestion from https://docs.brew.sh/Versions.html:

We create an empty repo on our GitHub account: https://github.com/Coeur/homebrew-repo
We add an empty commit to it (git commit --allow-empty -m &quot;first commit&quot;), otherwise brew may not find HEAD.
We extract the old formula with brew extract git Coeur/repo --version=2.20.1
We install this old formula with brew install coeur/repo/git@2.20.1

(note: uninstall command will be brew uninstall git@2.20.1)
More doc at https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap

Solution based on manual search

Find the repository of the formula with brew info git. It should tell us it's https://github.com/Homebrew/homebrew-core/blob/master/Formula/git.rb
From that page, click the History button on the right to get to https://github.com/Homebrew/homebrew-core/commits/master/Formula/git.rb
Choose a commit diff with your relevant version, for instance https://github.com/Homebrew/homebrew-core/commit/67903b677219559ac72b3fb45932d43426e157f0#diff-3e84bae646d908b93e043833873d316d for 2.20.1
Click View file to get to the full file at this version: https://github.com/Homebrew/homebrew-core/blob/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb
Click Raw to get to the raw file at this version: https://raw.githubusercontent.com/Homebrew/homebrew-core/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb
We install this formula with brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/67903b677219559ac72b3fb45932d43426e157f0/Formula/git.rb

(note: uninstall command will be brew uninstall git)