Why is git ignoring my changed file?

前端 未结 9 1141
南旧
南旧 2021-02-04 05:22

I make an arbitrary change to a file within my git working directory.

git status does not recognized that the file has changed.

git add /path

9条回答
  •  梦如初夏
    2021-02-04 06:18

    Also make sure that you have not manually updated the index to assume that the changed file(s) are unchanged like so:

    git update-index --assume-unchanged path/to/file
    

    As dumb as it sounds I did that, then a few days later made changes to the file and could not figure out why git was not tracking it. I tried all of the above suggestions, and kept pulling my hair out b/c the changed file was not listed in any .gitignore or exclude files.

    If you've told git to assume the file is unchanged, you will have to:

    git update-index --no-assume-unchanged path/to/file
    

    or just re-clone the repo like I ended up doing before I remembered what I had done...

提交回复
热议问题