How to find deleted files in a single commit in gitlab

271 Views Asked by At
git show -m -1 --name-only --pretty=format: --stat --relative --first-parent commit_id

I am using above command to list all the files in a commit. It is listing all the deleted files as well.

I want to remove deleted files from my list.

Is there a way to exclude deleted files from git show command?
Or is there a way to list deleted files from a commit id?

1

There are 1 best solutions below

3
VonC On

Check first if adding the --diff-filter option of git show helps

--diff-filter=ACMRTUXB

So anything but "D", which would filter for deleted files.

Shorter version (since Git 1.8.5):

 --diff-filter=d

The lowercase "d" means: everything but deleted files.