git 显示我删除了存储库中的所有文件,并在执行 git pull 后将它们暂存以供提交。为什么?

ErJ*_*Jab 6 git git-pull

这就是我所做的:

$ git pull
remote: Counting objects: 446, done.
remote: Compressing objects: 100% (372/372), done.
remote: Total 383 (delta 280), reused 0 (delta 0)
Receiving objects: 100% (383/383), 652.75 KiB | 381 KiB/s, done.
Resolving deltas: 100% (280/280), completed with 43 local objects.
Fast-forward
<list of files and summary of changes>
Run Code Online (Sandbox Code Playgroud)

现在,当我输入 git status 时,git 会显示我删除了存储库中的所有文件,并且我将它们暂存以供提交。它还向我显示所有未跟踪的文件。

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   deleted:    ....
#   deleted:    ....
#   deleted:    ....
<a list of all files in the repo>
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
<a list of all top-level files and folders in the repo>
Run Code Online (Sandbox Code Playgroud)

然后当我输入git add .then时git status,它显示没有要提交的更改。

知道为什么会发生这种情况吗?

eck*_*kes 6

不知道为什么会发生这种情况,但由于这是一个快进拉动,你可以简单地

git reset --hard origin/master
Run Code Online (Sandbox Code Playgroud)

取消所有内容并使您的 WC 等于master原点。