0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Git小技】ファイル名を小文字⇔大文字に変更してコミットする方法

Posted at

(How to Change Filename Case in Git)

🧾 TL;DR

Gitでは、ファイル名の大文字・小文字だけを変更しても認識されないことがあります。
その場合は、一時的に別の名前へ変更してから再変更することで、正しくコミットできます。

🧩 概要

Gitはデフォルトで「大文字・小文字の違い」を同一ファイルとみなす設定になっているため、単純に 、

qiita.rb
git mv budgetService.ts BudgetService.ts

としても変更が反映されないことがあります。

この投稿では、そのような場合に確実にファイル名を変更・コミットする手順を紹介します。

🎯 目的

・大文字/小文字の差だけでファイル名を変更したいときの手順を学ぶ。

・OS(特にWindowsやmacOS)でGitが変更を検知しない問題を回避する。

🧭 手順

1️⃣ 一時ファイル名に変更する

まず、一時的に別名(例:temp.ts)へリネームします。

qiita.rb
git mv budgetService.ts temp.ts

2️⃣ 目的のファイル名に再変更する

次に、目的のファイル名(例:BudgetService.ts)に変更します。

qiita.rb
git mv temp.ts BudgetService.ts

これで、Gitが変更を正しく認識し、コミットできるようになります。

💡 まとめ

・大文字・小文字の違いだけではGitが変更を検知しないことがある。

・一度別名に変更してから再リネームすることで確実に反映できる。

・チーム開発やWindows環境で特に有効です。

🏷️ タグ候補

#Git #小技 #初心者 #開発手順 #ファイル名

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?