How do I commit case-sensitive only filename changes in Git?

前端 未结 16 2474
我在风中等你
我在风中等你 2020-11-22 03:31

I have changed a few files name by de-capitalize the first letter, as in Name.jpg to name.jpg. Git does not recognize this changes and I had to de

16条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 04:04

    I tried the following solutions from the other answers and they didn't work:

    • git mv filename
    • git rm -f filename

    If your repository is hosted remotely (GitHub, GitLab, BitBucket), you can rename the file on origin (GitHub.com) and force the file rename in a top-down manner.

    The instructions below pertain to GitHub, however the general idea behind them should apply to any remote repository-hosting platform. Keep in mind the type of file you're attempting to rename matters, that is, whether it's a file type that GitHub deems as editable (code, text, etc) or uneditable (image, binary, etc) within the browser.

    1. Visit GitHub.com
    2. Navigate to your repository on GitHub.com and select the branch you're working in
    3. Using the site's file navigation tool, navigate to the file you intend to rename
    4. Does GitHub allow you to edit the file within the browser?
      • a.) Editable
        1. Click the "Edit this file" icon (it looks like a pencil)
        2. Change the filename in the filename text input
      • b.) Uneditable
        1. Open the "Download" button in a new tab and save the file to your computer
        2. Rename the downloaded file
        3. In the previous tab on GitHub.com, click the "Delete this file" icon (it looks like a trashcan)
        4. Ensure the "Commit directly to the branchname branch" radio button is selected and click the "Commit changes" button
        5. Within the same directory on GitHub.com, click the "Upload files" button
        6. Upload the renamed file from your computer
    5. Ensure the "Commit directly to the branchname branch" radio button is selected and click the "Commit changes" button
    6. Locally, checkout/fetch/pull the branch
    7. Done

提交回复
热议问题