1

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 ?

Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197

1 Answers1

1

--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

user3159253
  • 16,836
  • 3
  • 30
  • 56
  • is there a way of side-by-side diff generation in patch file ? – Ciasto piekarz Jan 25 '14 at 04:50
  • 1
    Well, `git diff` allows to run external diff, including side by side diff. See http://stackoverflow.com/questions/7669963/how-can-i-get-a-side-by-side-diff-when-i-do-git-diff However likely `git format-patch` doesn't support this. If you manage to get side by side diff with "stock" `git diff`, then you may try to use these flags in `git format-patch` too. – user3159253 Jan 25 '14 at 07:50