code refactoring

- added get_branch
- move the commit parsing from the check_*  functions
- parse the commits only once