Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent /dev/null/ from dumping when running git diff

Tags:

git

diff

When I try to dump differences between two folders with

git diff --no-index --name-only folder1 folder2 > diff.txt

I encounter a lot of /dev/null strings. It shows the removed folders as far as I know. But I don't need those in my file. How can I prevent it from dumping?

like image 846
Doğa Can Kılıç Avatar asked Nov 17 '25 13:11

Doğa Can Kılıç


2 Answers

Check if you can add the --diff-filter=d option, to exclude deleted paths

git diff --no-index --name-only --diff-filter=d folder1 folder2
like image 198
VonC Avatar answered Nov 20 '25 02:11

VonC


You can use the option -D aka --irreversible-delete (manual page). It will not show the content of deleted files, but still show that the file was deleted.

like image 45
j6t Avatar answered Nov 20 '25 02:11

j6t



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!