diff --git a/cadetrdm/repositories.py b/cadetrdm/repositories.py index a72ef2e76f28f0cb20c570219e3c57c0c6d930d9..4e0f57d2fc37731446f9bd2c4fe1d054454665e3 100644 --- a/cadetrdm/repositories.py +++ b/cadetrdm/repositories.py @@ -115,7 +115,13 @@ class BaseRepo: :return: """ previous_branch = self.active_branch.name - if str(self.head.commit) == self.earliest_commit: + if previous_branch == "master": + return + + commit_of_current_master = str(self._git.rev_parse("master")) + commit_of_current_branch = str(self.head.commit) + if commit_of_current_branch == commit_of_current_master: + print("Removing empty branch", previous_branch) self._git.checkout("master") self._git.branch("-d", previous_branch)