开发者

Git pull fails: You have unstaged changes. Git status: nothing to commit (working directory clean)

When trying to do a git pull I get "You have unstaged changes.". When I do a git status it says: nothing to commit (working directory clean). Why?

I can do a git reset --hard, then pull, 开发者_开发百科but I don't understand why pull fails in the first time.


If you have a older version of git, it is in a stale state. Just do a git status and you can do git pull.


The Git “nothing to commit, working directory clean” message tells us that we have not made any changes to our repository since the last commit.

If this message appears and the contents of your remote repository are different to your local repository, check to make sure you have correctly set up an upstream branch. You can check the step in this link to solve your problem. https://careerkarma.com/blog/git-nothing-to-commit-working-directory-clean/#:~:text=The%20Git%20%E2%80%9Cnothing%20to%20commit,set%20up%20an%20upstream%20branch.


As @J-16 SDiZ said, do a git status. I find a common problem is that people delete a file from their project without deleting it from git with git rm. So git status can give you a list of such files, and if it does, go ahead and just do:

git rm <copy_paste_filename_here>

for each such file.

Then commit your changes and try again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜