git获取最近一次提交的内容(只要message不要hash)
命令如下:
git show --pretty=format:"%s" -s HEAD
效果:
Python中获取:
import shlex
import subprocess
cmd = 'git show --pretty=format:"%s" -s HEAD'
r = subprocess.run(shlex.split(cmd), capture_output=True)
out = r.stdout.decode()
print(out)