Git adding “unchanged” files to the stage

左心房为你撑大大i 提交于 2019-12-08 17:02:37

问题


For a project I'm working on, I want to use:

git add . -A

to add some files to the stage. The problem is that Git thinks these files are unchanged from the last commit, so they are ignored. However, I personally changed the file, but Git still sees the file as unchanged.

How can I "forcefully" add that single file to my repository?


回答1:


check your .gitignore file there must be some pattern matching this file which is excluding file from being staged. Or you can use git add . -f to forcely add these files.




回答2:


It seems like the assume-unchanged-bit is set for that file. With that bit set, git will not look for changes of that file anymore. Unset it by typing:

git update-index --no-assume-unchanged <file>

After that, git status as well as git add should detect the changed file.



来源:https://stackoverflow.com/questions/18600639/git-adding-unchanged-files-to-the-stage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!