2d keep player upright

If i get hit from the side my player starts rotating and stops in a random position, but instead i want it to go back to it’s initial position which is upright. How can i do something like that?

Here’s an illustration:
71580-untitled-1.jpg

You can save initial rotation in variable then use the Quaternion.Lerp function with current rotation and initial rotation as target rotation.

PS. You can try Slerp method too (read in google about diffrence).