Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_current_branch(self) -> str:
cmd = ("rev-parse", "--abbrev-ref", "HEAD")
_, out = self.run_git_captured(*cmd)
if out == "HEAD":
raise NotOnAnyBranch()
return out