Clearing history deletes cookies and caches associated with the sites you visited.
This includes the login information.
That is the reason why you have to enter the information when you login to those sites again
after clearing history.
“Cookies and website data saved while visiting webpages”
https://support.apple.com/kb/PH19215?locale=en_US
To remove just history but not other data associated with the sites:
Click “History” in the Safari menu bar and then choose “Show History”.
When the page opens with list of the sites visited, highlight the sites and click “Delete” key
on the keyboard.
Don’t click the button “Clear History” at the left bottom of the page.
Best.