When I type git status , I see:
# On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: DIR/a #
However, in my working directory, I see that this file is actually called dir/a (note the lowercase dir instead of dir ).
Question: I want to add this modified file a to the staging area and commit, but I want it to be the same as in my working directory (which shows dir/a ) - unlike the way git sees it as dir/a . How can i do this?
Important Note:
Unfortunately, I cannot just git mv DIR/a dir/a , because dir/a does not actually exist in the working tree.
Currently, my .git/config file shows ingorecase = true , so I know that I need to set the value to false. However, after he changed this flag, now git status shows:
# On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: DIR/a # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # dir/
I expected this since git only tracks content, and switching ignorecase will make git think about adding a new file. Unfortunately, git now thinks that I have two files that change when in fact I only have one. I want git status simply display dir/a (as in my working directory) instead of dir/a with the same a differences that I recently did.
Additional note
If you are interested in how such an unstable situation arose, I was able to reproduce the stupid mistakes that I made when they initially renamed the case of my directory from dir to dir . If you think that this will help in solving this problem, I would be happy to make an edit that will show how I mistakenly made git so confusing. (this leads to a random hit of mv instead of git mv and ignorance of the ignorecase flag and leaving it as ignorecase=true ).
git
smaccoun
source share