AI Hints
Home›Git & GitHub Tutorial›Everyday Gotchas
Git & GitHub · Lesson 117 of 144

Changing Capital Letters

Case-only renames.

⏱ 2 min read▶ Video at 2:08:24🎓 Free
Watch this lesson in the Git & GitHub courseWatch on YouTube ↗Full Git & GitHub course

On Mac and Windows, the file system usually treats Logo dot PNG, with a capital L, and logo dot PNG, as the same file. So renaming a file by changing only its capitals can confuse Git, and your teammates on Linux.

Changing Capital Letters
From the video: Changing Capital Letters
  • Logo.png or logo.png?
  • Mac and Windows: the same file
  • Linux: two different files

Use git mv

The safe way is git m v. Git m v, capital L logo dot PNG, lowercase logo dot PNG. Status shows a proper rename. Commit it, and everyone, on every system, gets the new name.

git
git mv Logo.png logo.png
git status --short
R  Logo.png -> logo.png
git commit -m "Lowercase logo filename"
[main 93185c9] Lowercase logo filename
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename Logo.png => logo.png (100%)

Summary

For capital-letter-only renames, always use git m v, so Git records the rename properly. Next, a full project, from start to finish.

Key takeaways
  • Case-insensitive on Mac and Windows
  • git mv Old new
  • Commit the rename
Next up: Project: A Portfolio Site — solo, start to finish