Skip to main content
Git Case Sensitivity and Fixing Filenames
  1. Blog/

Git Case Sensitivity and Fixing Filenames

151 words
Git Documents - This article is part of a series.
Part 3: This Article

In a Git repository, if there’s a file named readme.md in previous commits and you want to change the filename to README.md, you may find that Git doesn’t recognize the change.

Git is case-insensitive by default. This article explains how to configure Git to be case-sensitive and fix filenames with the correct case.

Git Configuration
#

Git ignores case by default. You can check the current configuration with this command:

git config core.ignorecase
# Output result: true

Change Git to be case-sensitive with the following command:

git config core.ignorecase false

Fixing Filenames
#

git mv -f readme.md README.md

The -f parameter means force rename.

Committing Changes
#

After making the changes, you can commit them using the following commands:

git add README.md
git commit -m "docs: fix README.md filename case"

To check the status of your changes:

git status
# Output will show the rename operation
# renamed: readme.md -> README.md
Git Documents - This article is part of a series.
Part 3: This Article