What does it mean when Git diff shows mode changes?

49,424

Solution 1

Most probably, the contents of this file haven't changed, only the executable bit has been cleared. Try actually changing the file by, say, appending an empty line to it, and see what git diff outputs.

Apart from file contents, Git also records the state of the executable bit for each file. It makes sense on Linux systems if you want scripts to be executable right after checkout. See also the following two related questions:

How do I make Git ignore file mode (chmod) changes?

How do I remove files saying "old mode 100755 new mode 100644" from unstaged changes in Git?

Solution 2

It means that the file mode changed from 755 to 644, but the contents were not altered.

git diff is exactly what you are looking for - it shows the changes from unstaged files to the last commit. git diff --cached is for staged files.

Share:
49,424
pedja
Author by

pedja

Updated on July 08, 2022

Comments

  • pedja
    pedja almost 2 years

    I'm trying to view changes for a single file that is unstaged.

    First I use git status to view all the unstaged changes then for example:

    git diff AndroidManifest.xml
    

    But I get this output:

    diff --git a/AndroidManifest.xml b/AndroidManifest.xml  
    old mode 100755  
    new mode 100644
    

    What does that mean and how can I view changes for specific file?