def get_git_sha():# Which branch are we on?branch = open(".git/HEAD", "r").read()
# Parse output "ref: refs/heads/my_branch" -> my_branchbranch = branch.strip().split("/")[-1]
# What's the latest commit in this branch?return open(f".git/refs/heads/{branch}").read().strip()