git修改文件名大小寫敏感問題解決

. 在新建代碼文件時,不注意把文件名應該小小寫搞錯了
2. 文件已經push到遠程了
3. 在windows下面將文件名字改爲全小寫

改好後,在Git中沒有任何反應,使用git status時,如果遇到下面情況,說明GIT大小寫不敏感,如下:

[rock@ROCK-PC]$ /d/WampServer/www/hexu.org/code (dev)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean

如何解決Git的大小不敏感問題呢?
1. 方案一是設置Git大小寫敏感:

$ git config core.ignorecase false

2. 方案二是先刪除文件,再添加進去:

$ git rm ; git add  ;  git commit -m "rename file"

由於我是與大家共用的倉庫,所以我採用的方案2解決掉了。

$ git rm code/library/BuildTag*.php; git status
On branch dev
Changes to be committed:
  (use "git reset HEAD ..." to unstage)

        deleted:    code/library/BuildTagAfc.php
        deleted:    code/library/BuildTagAfs.php

rock@ROCK-PC /d/WampServer/www/hexu.org/code (dev)
$ git add code/library/BuildTag*.php; git status
On branch dev
Changes to be committed:
  (use "git reset HEAD ..." to unstage)

        renamed:    code/library/BuildTagAfc.php -> code/library/BuildTagafc.php
        renamed:    code/library/BuildTagAfs.php -> code/library/BuildTagafs.php
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章