What does it mean when Git diff shows mode changes?

GitGit Diff

Git Problem Overview


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?

Git Solutions


Solution 1 - Git

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:

https://stackoverflow.com/q/1580596/946850

https://stackoverflow.com/q/1257592/946850

Solution 2 - Git

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionpedjaView Question on Stackoverflow
Solution 1 - GitkrlmlrView Answer on Stackoverflow
Solution 2 - GitPolygnomeView Answer on Stackoverflow