0

I want to get the list of modified files in a pull request and group them by their commits sha. I have only found the git diff --name-status but it doesn't return the commit sha:

I have a backup plan to use git format-patch -1 , but the results are large files that includes the content of the files, which makes it very inefficient to parse.

I was wondering if there is another way to approach this problem?

Thanks

Kayhan
  • 13
  • 6
  • 1
    Possible duplicate of [How to make git diff show the same result as github's pull request diff?](https://stackoverflow.com/questions/37763836/how-to-make-git-diff-show-the-same-result-as-githubs-pull-request-diff) – William Perron May 28 '18 at 20:04

2 Answers2

1

I found what I needed:

git show --diff-filter=dr --name-only sha

--diff-filter=dr because I wanted to filter out deleted or renamed files.

Btw, I was asking this because the GitHub API has limitations on the number of files it returns for a commit. So, I needed to clone the repo and do it locally.

@phd: Thanks for your help, it guided me in the right direction.

Kayhan
  • 13
  • 6
0

To list files modified in commits run

git log --name-only

You can modify the output using huge number of git log options.

But that has nothing to do with backup so you perhaps need to change your backup plans.

phd
  • 82,685
  • 13
  • 120
  • 165