[git] If there's no local branches, the history does not fail, so add an additional check (fixes #366)