pedja pedja - 2 months ago 15
Git Question

What does it mean when Git diff shows mode changes?

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

first i use

git status
to view all 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

Answer

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?