gitpython and git diff

后端 未结 6 1383
终归单人心
终归单人心 2021-02-12 21:48

I am looking to get only the diff of a file changed from a git repo. Right now, I am using gitpython to actually get the commit objects and the files of git changes, but I want

6条回答
  •  天涯浪人
    2021-02-12 22:44

    Git does not store the diffs, as you have noticed. Given two blobs (before and after a change), you can use Python's difflib module to compare the data.

提交回复
热议问题