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?
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?
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.