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 delete the files and upload them again. Is there a way that Git can be case-sensitive when checking for changes in file names? I have not made any changes to the file itself.
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
You can use git mv:
Under OSX, to avoid this issue and avoid other problems with developing on a case-insensitive filesystem, you can use Disk Utility to create a case sensitive virtual drive / disk image.
Run disk utility, create new disk image, and use the following settings (or change as you like, but keep it case sensitive):
Make sure to tell git it is now on a case sensitive FS:
Mac OSX High Sierra 10.13 fixes this somewhat. Just make a virtual APFS partition for your git projects, by default it has no size limit and takes no space.
Sensitive
git
andln -s /Volumes/Sensitive/git /Users/johndoe/git
Your drive will be in
/Volumes/Sensitive/
How do I commit case-sensitive only filename changes in Git?
Git has a configuration setting that tells it whether to be case sensitive or insensitive:
core.ignorecase
. To tell Git to be case-senstive, simply set this setting tofalse
:Documentation
From the
git config
documentation:Case-insensitive file-systems
The two most popular operating systems that have case-insensitive file systems that I know of are
This is what I did on OS X:
Two steps because otherwise I got a “file exists” error. Perhaps it can be done in one step by adding
--cached
or such.Using SourceTree I was able to do this all from the UI
FILE.ext
towhatever.ext
whatever.ext
tofile.ext
It's a bit tedious, but if you only need to do it to a few files it's pretty quick