example of `git add --dry-run .` listing file sizes in descending order?

Viewed 32

I have a wide range of patterns in .gitignore, but sometimes things slip through.

Can someone tell me how to either:

  1. do a dry run of git add ./git add --all but get some sanity check output alerting me if something really big accidentally showed up.
  2. recursively match the contents of .gitignore against the project folder and list the complement with file sizes in descending order
1 Answers

Another approach would be to:

  • git add .
  • git commit -m "new commit"
  • list files per size to see if anything is amiss. If so, reset to @~.

To list file size of the new commit:

git ls-tree --format="%(objectsize) %(objectname)" @|sort -n -r
Related