2

I used the following code to get the changed file name list.

git show --pretty="format:" --name-only

However, the result will include all the file names. As I only want the modified ones , is there a way to exclude the deleted ones?

Johnny Chen
  • 2,025
  • 1
  • 18
  • 27
  • http://stackoverflow.com/questions/10018533/is-it-possible-to-git-status-only-modified-files – Alec Aug 15 '13 at 07:39

1 Answers1

4

I think the best is to use the diff command with diff-filter applied:

git diff --name-only --diff-filter=AM

This should give you the list of added and modified files (AM in diff filter) when comparing your working tree to the index.

You could also apply the --diff-filter option to show command but this one is. To check more flags you can set on the --diff-filter option check the here.

jurglic
  • 3,599
  • 1
  • 17
  • 13