The retention period for local history varies according to the version of IntelliJ.
For example in 2017.x and in 2016.x:
Local history is cleared when you install a new version of IntelliJ IDEA or when you invalidate caches. Therefore, check in the changes to your version control system before performing these operations.
But in 2018.x (see the section titled Retention period for Local History):
By default, Local History is configured to store revisions for the last 5 working days (that is, days when the file was modified).
The 2018.x link includes instructions on how to extend the default retention period including this suggestion:
You can change the default period of how many days local history will be kept for
See also: https://stackoverflow.com/a/11829639/2000323