简体   繁体   中英

Git is ignoring my changed file

I've got the following output on a git status:

Changes to be committed: (use "git reset HEAD ..." to unstage)

  modified: Views/Deploy/Index.cshtml 

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory)

  modified: DeployController.cs 

However, running

git add deploycontroller.cs

doesn't seem to do anything. It will pause the console window for just a moment as if it's working, but there's no output or anything, and another git status will show it's still unstaged.

I've used the following commands:

git check-ignore * **/* | grep deploycontroller.cs
git ls-files -v | grep deploycontroller.cs

which showed that it's not in an ignored, skip-worktree, or assume-unchanged status (when running those commands, there was no feedback from the console, but when run from a higher level to a generic folder, it correctly displayed ignored files, for instance)

And finally, I tried

git add --force deploycontroller.cs

No dice - it pauses as though it's working, but it doesn't add it.

Any thoughts?

Just for anyone unsure, my solution was as simple as a case sensitivity issue. When I tried

git add deploycontroller.cs

It would work for a moment as if it had done something, but there were no changes to anything as far as I could tell. That being said, I didn't get any error messages.

When I tried

git add fdajklfjdsaklfsa.cs

It would give me a fatal error stating that it couldn't find the specified file, which led me to believe the first command was functional. Thanks to JRLambert, I was able to determine that git simply wasn't giving an error message for the first command, despite it not working.

When I tried

git add DeployController.cs

everything worked as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM