windows下git显示文件被修改,实际没有改动的问题解决办法
2023-04-02 00:21:39
Art
当我们pull完代码时进行修改,修改后提交代码时会发现一些文件并未修改,但显示有差异,而且通过git status查看时是Untracked file如下:
$ git status On branch master Your branch is behind 'origin/master' by 27 commits, and can be fast-forwarded. (use "git pull" to update your local branch) Untracked files: (use "git add <file>..." to include in what will be committed) model/src/main/java/ nothing added to commit but untracked files present (use "git add" to track)
出错的文件正是那些不是我们修改的文件,这时候可以用如下方式进行处理:
git fetch origin master
git reset --hard FETCH_HEAD