I like to have lots of shells open, some inside emacs and some in stand-alone terminals. With the default settings, it seems that the last shell to exit saves its history to the file:
If the histappend shell option is enabled (see the description of shopt under SHELL BUILTIN COMMANDS below), the lines are appended to the history file, otherwise the history file is overwritten
(from the bash man page)
It’s nice to be able to dig out some obscure shell command issued ages ago when you need it.
So stick the following lines in your .profile at amend this:
shopt -s histappend
export HISTFILESIZE=1000000