如何配置Git支援大小寫敏感和修改檔案名稱中大小寫字母呢?(轉)

來源:互聯網
上載者:User

標籤:

1. 在建立代碼檔案時,不注意把檔案名稱應該小小寫搞錯了
2. 檔案已經push到遠程了
3. 在windows下面將檔案名稱字改為全小寫

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

 
123456 [rock@ROCK-PC]$ /d/WampServer/www/hexu.org/code (dev)$ git statusOn branch masterYour branch is up-to-date with ‘origin/master‘. nothing to commit, working directory clean

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

 
1 $ git config core.ignorecase false

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

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

 

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

 
12345678910111213141516 $ git rm code/library/BuildTag*.php; git statusOn branch devChanges 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 statusOn branch devChanges 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

 

http://blog.hexu.org/archives/1909.shtml

如何配置Git支援大小寫敏感和修改檔案名稱中大小寫字母呢?(轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.