Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git shows files changed with 0 insertions(+), 0 deletions(-)

Tags:

git

There are many times when I run a "git diff --shortstat" command and it outputs the following:

17 files changed, 0 insertions(+), 0 deletions(-)

Hows that possible that files changed even though there were no insertions or deletions?

like image 261
Rajat Avatar asked Dec 25 '22 04:12

Rajat


1 Answers

This is possible if the file permissions have changed for some of the files in the project:

Sample Example:

$ git init && touch file && git add file && git commit -m "msg"
Initialized empty Git repository in /home/user/Desktop/test/.git/
$ chmod +x file
$ git diff --shortstat 
 1 file changed, 0 insertions(+), 0 deletions(-)

You can use git config core.filemode false to turn this feature off.

like image 113
Anshul Goyal Avatar answered Jan 18 '23 00:01

Anshul Goyal