Why doesn't git recognize that my file has been changed, therefore git add not working

前端 未结 24 2349
野趣味
野趣味 2020-12-04 08:07

I am trying to push my files to github using bash. They are already on there, and I am uploading a newer version with new lines and code, etc. But when I try git add<

24条回答
  •  半阙折子戏
    2020-12-04 08:25

    I had a problem where once upon a time I set the git index to 'assume unchanged' on my file.

    You can tell git to stop ignoring changes to the file with:

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

    If that doesn't help a reset may be enough for other weird cases.


    In practice I found removing the cached file and resetting it to work:

    git rm --cached path/to/file
    git reset path/to/file
    

    The git rm --cached means to only remove the file from the index, and reset tells git to reload the git index from the last commit.

提交回复
热议问题