List all changed files with change status between Git commits (added, modified, deleted)

git, git-diff

Solution

Use `--name-status`, it's the same as `--name-only` plus the status of changed files:

git diff --name-status SHA1 SHA2

Problem

I regularly use the following command to list files changed between two commits: ``` git diff --name-only SHA1 SHA2 ``` It gives a list of files somewhat like this: ``` /src/example/file1 /src/example/file2 /src/example/file3 ``` There is almost no end to how useful this is. I'd really like to be able also to show alongside each file a brief reference to the change status, indicating whether a file was added, modified or deleted. Here's an example to demonstrate the concept: ``` git diff --name-only --and-how-me-the-change-status SHA1 SHA2 ``` ``` A /src/example/file1 M /src/example/file2 D /src/example/file3 ``` The change status (A, M, D) is shown as an example only, I don't mind what this is so long as it is unambiguous. I'm aware that I can use the `--diff-filter` option to list only added files, or only modified files or only deleted files. Using this option means I have to run three commands to get three lists of filenames. This is nice but could be nicer. Is there a single command I can run to give me the above example output?

Original source

Related problems