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

前端 未结 24 2245
野趣味
野趣味 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:23

    try to use git add * then git commit

    0 讨论(0)
  • 2020-12-04 08:24

    Ran into the issue, but it was only two directories and unknown to me was that both those directories ended up being configured as git submodules. How that happened I have no clue, but the process was to follow some of the instructions on this link, but NOT remove the directory (as he does at the end) but rather do git add path/to/dir

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-12-04 08:27

    In general with this issue, first check that you're editing the file you think you are! I had this problem when I was editing a transpiled JavaScript file instead of the source file (the transpiled version wasn't under source control).

    0 讨论(0)
  • 2020-12-04 08:27

    Make sure not to create symlinks (ln -s source dest) from inside of Git Bash for Windows.

    It does NOT make symlinks, but does a DEEP copy of the source to the dest

    I experienced same behavior as OP on a MINGW64 terminal from Git Bash for Windows (version 2.16.2) to realize that my 'edited' changes actually were in the original directory, and my git bash commands were from within a deep copy that had remained unchanged.

    0 讨论(0)
  • 2020-12-04 08:27

    I had the same problem. Turns out I had two copies of the project and my terminal was in the wrong project folder!

    0 讨论(0)
提交回复
热议问题