Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import subprocess
if __name__ == "__main__":
current_branch = subprocess.check_output(["git", "branch", "--show-current"]).rstrip()
if not current_branch:
raise Exception("need to be checked out to a named git branch")
merged_branches_with_upstream = subprocess.check_output(
["git", "branch", "--format", "%(refname:short) %(upstream:short)", "--merged"]