HISTCONTROL variable is a colon-separated list of values controlling how commands are saved in the history list.
HISTCONTROL=ignoredups
It causes lines matching the previous history entry to not be included. It does not add a command to history if it's the same as the immediate previous commands. It doesn't further back in the history list
HISTCONTROL=ignorespace
causes lines that begin with a white space character to not be included in the history list
HISTCONTROL=ignoreboth
It is the same as HISTCONTROL=ignorespace:ignoredups
HISTCONTROL=erasedups
It allows all previous lines matching the current line to be eliminated from the history list before that line is saved