By default, Record Level Sharing bubble up to all the user who is above in the hierarchy chain.
Let's imagine we have a simple hierarchy: lead (10 users) -> developer (40 users)
If each lead has 4 developers as their subordinates. How can we restrict access of the developer record to share only to their lead and not with other leads who all are having the same role?
Able to achieve the same by using manager groups feature in sharing settings:
Steps to follow:
Reference Links:
https://help.salesforce.com/articleView?id=users_managers_only.htm&type=5
https://focusonforce.com/configuration/salesforce-manager-group-sharing/