correctly handle non-default branch case in getAllCommitsForBranch() method