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

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

    I had this issue. Mine wasn't working because I was putting my files in the .git folder inside my project.

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

    It happend to me as well, I tried the above mentioned methods and nothing helped. Then the solution was to change the file via terminal, not GUI. I do not know why this worked but worked. After I edited the file via nano from terminal git recognized it as changed and i was able to add it and commit.

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

    well we don't have enough to answer this question so I will give you several guesses:

    1) you stashed your changes, to fix type: git stash pop

    2) you had changes and you committed them, you should be able to see your commit in git log

    3) you had changes did some sort of git reset --hard or other, your changes may be there in the reflog, type git reflog --all followed by checking out or cherry-picking the ref if you ever do find it.

    4) you have checked out the same repo several times, and you are in the wrong one.

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

    Sounds crazy, but sometimes you are not in the right repo even though you think you are. For example, you may have moved the parent directory, but forgot to switch repos in your text editor. Or vice versa: you're in the right repo in the text editor but the wrong repo in command line. In the first situation, you make your edits in the right file but it's not the same folder that's open in your command line, so it's actually the wrong file. In the second situation, you actually did edit the right file, but your command line git won't recognize the change because you're not in the correct directory on the command line.

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

    I had a similar issue when I created a patch file in server with vi editor. It seems the issue was with spacing. When I pushed the patch from local, deployment was proper.

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

    What kind of file do you tried to upload? Now I just spend almost an hour to upload my css modification. But this css compiled from a styl file therefore git just ignored it. When I changed the styl source then everything worked.

    Hope it helps.

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