import os import git # Global variables and constant current_dir = os.getcwd() repo = git.Repo(current_dir) tree = repo.head.commit.message print(tree)