Git File Modes and Filesystem Behavior
Read modes, not full permissions
Git records ordinary non-executable files as 100644 and executable files as 100755; symbolic links are 120000. It does not preserve arbitrary POSIX permission combinations, owners or ACLs. A mode-only change can modify a tree while retaining the blob ID. In the Linux lab run.sh starts as non-executable. Inspect the index and then add a change to the executable bit. The script is synthetic and need not be executed.
git ls-files --stage -- run.shchmod +x run.shgit add -- run.shgit diff --cached --summarygit ls-files --stage -- run.shDiagnose unreliable executable bits
core.filemode=false tells Git to disregard ordinary executable-bit differences between the working filesystem and index. It does not remove recorded executable modes from commits. On a filesystem that cannot reliably report the bit, git update-index --chmod=+x can intentionally set the indexed mode; review the staged result. Do not globally disable mode checks to silence unexplained changes. Some scripts require an executable bit on Unix but have different launch conventions on Windows.
git config --local core.filemode falsegit update-index --chmod=+x -- run.shgit diff --cached --summaryCase and symbolic links
A case-sensitive filesystem can distinguish Notes.txt and notes.txt; a case-insensitive one may not represent both. core.ignoreCase is an adaptation to filesystem behavior, not a switch that changes the filesystem. For a case-only rename use a unique intermediate name and review the staged rename. Git stores a symlink target as blob content, not the target file itself. With core.symlinks=false a checkout can represent a link as a regular file containing its target text while the index still records 120000. Windows permissions and filesystem settings, and macOS volume formatting, vary; test the actual environment rather than assuming all installations behave alike.
git mv notes.txt notes-rename-tmp.txtgit mv notes-rename-tmp.txt Notes.txtgit diff --cached --name-statusPractice
If the staged mode changes from 100644 to 100755 but the blob ID is unchanged, what changed? Explain why toggling core.ignoreCase will not make a volume case-sensitive. The lab checks Linux mode and symlink behavior only; use separate Windows and macOS tests before claiming portability.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Git File Modes and Filesystem Behavior — knowledge check
Reason about configuration, platform behavior and execution boundaries.
What does mode 100755 represent?
Mode changes but blob ID remains identical. What changed?
What does core.filemode=false do?
What does a symlink blob store?
What can core.ignoreCase not do?