How do I find number of vertical lines available in the terminal?

I’m writing a script which shows the git log for a directory when I cd into it. Such a log can be overwhelming, containing hundreds of lines. So far I have been limiting that to a hard-coded 20 lines (... | head -n 20), which is fine on the screen at work, but too much on the smaller MacBook screen at home.