Git - get all commits and blobs they created

blob, commit, git

Solution

To get commits (all and output one line per commit):

git rev-list --all --pretty=oneline

Then split commits by space with limit of 2 and get every commit id and message

To get blobs created by commit (recurse to subdirs, show merge commits, detect renames and copies, don't show commit id on first line):

git diff-tree -r -c -M -C --no-commit-id <commit-sha>

A bit of parsing of every line and excluding some of them — and we get list of new blobs and they path for commit

Last is to get blob sizes:

git cat-file --batch-check < <list-of-blob-shas>

And another time a bit of parsing

Problem

Is there a git command that can output for every commit: - id - subject - blobs it created with they path and size (like `git ls-tree -l -r <commit>` but only for created blobs)

Original source