MacOS: Bash shell history not showing recent shell commands

On macOS I often run into a problem where the Bash commands I enter in one Terminal tab or window are not available in another tab, and sometimes — like today — those commands aren’t even available when I completely restart the Terminal. The problem and solution starts with this text on the page I linked to:

Terminal assigns each terminal session a unique identifier and communicates it via the TERM_SESSION_ID environment variable so that programs running in a terminal can save/restore application-specific state when quitting and restarting Terminal with Resume enabled.

A new folder (~/.bash_sessions/) is used to store HISTFILE's and .session files that are unique to sessions.

During shell startup the session file is executed. Old files are periodically deleted.

My solution for today was to cd into the ~/.bash_sessions directory and then grep for the commands I knew I entered earlier this morning. Technically I grep’d for part of the commands, because I couldn’t remember all of them, which is why I was searching through my Bash history in the first place. By doing this I quickly found what I was looking for.