Refactor gets_commit_by_user method