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?

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.