Search code examples
git

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


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?


Solution

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