Changing capitalization of filenames in Git

前端 未结 9 1589
孤独总比滥情好
孤独总比滥情好 2020-11-22 14:02

I am trying to rename a file to have different capitalization from what it had before:

git mv src/collision/b2AABB.js src/collision/B2AABB.js
fatal: destinat         


        
9条回答
  •  隐瞒了意图╮
    2020-11-22 14:15

    Sometimes you want to change the capitalization of a lot of file names on a case insensitive filesystem (e.g. on OS X or Windows). Doing git mv commands will tire quickly. To make things a bit easier this is what I do:

    1. Move all files outside of the directory to, let’s, say the desktop.
    2. Do a git add . -A to remove all files.
    3. Rename all files on the desktop to the proper capitalization.
    4. Move all the files back to the original directory.
    5. Do a git add .. Git should see that the files are renamed.

    Now you can make a commit saying you have changed the file name capitalization.

提交回复
热议问题