This example uses kubernetes-helm
as the forumla being installed.
Checkout the homebrew-core repo:
git clone git@github.com:Homebrew/homebrew-core.git && cd homebrew-core
Find the commit hash related to the formula version that you wish to install:
git log master -- Formula/kubernetes-helm.rb
Checkout a branch at that commit:
gco -b kubernetes-helm-2.12.2 e046a932a36345bf90398a19272e57c7fc640494
Install using this particular formula file:
brew install Formula/kubernetes-helm.rb