Enchanced getCommitKey function to be able to work on branches