git ls-files: howto identify new files (added, not committed)?

You want to use git diff --cached. With --name-only it’ll list all the files you’ve changed in the index relative to HEAD. With --name-status you can get the status symbol too, with --diff-filter you can specify which set of files you want to show (‘A’ for newly added files, for instance). Use -M to turn on move detection and -C for copy detection if you want them.

For the strictest reading of what you wrote, git diff --cached --name-only --diff-filter=A will list all the files you’ve added since HEAD which don’t exist in HEAD.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)