3

私は Python/Git 初心者ですが、2 つのブランチまたはコミットをパラメーターとして取り、2 つの間で変更されたファイルのリストを表示するスクリプトを作成しようとしています。

これは、bash スクリプトで

git diff --name-only FIRSTBRANCH...SECONDBRANCH

しかし、gitpython を使用した Python スクリプトに簡単に変換することはできません。誰かがこれを行う方法を知っていれば、それは素晴らしいことです。

編集:ここにいくつかのコードがあります

user = str(sys.argv[1])
password = str(sys.argv[2])
currentBranch = str(sys.argv[3])
compBranch = str(sys.argv[4])

repo = Repo(directory)
currentCommit = repo.commit(currentBranch)
compCommit = repo.commit(compBranch)
diffed = repo.diff(currentBranch, compBranch)

変更されたファイルのリストのみが必要な場合、print diff はすべての差分の詳細を返します

4

2 に答える 2