سؤال

how to store git format-patch output to a variable instead of writing to a disk using python?

or is there any other way to create a git diff with subject line ?

هل كانت مفيدة؟

المحلول

--stdout option to git format-patch

the complete Python expression should be like: var = subprocess.check_output(["git", "format-patch", "--stdout", <tree-ish arguments...>])

Also you may consider using GitPython if you need extensive git repo manipulations

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top