无法重设基础:您有未老化的更改git

无法重设基础:您有未老化的更改git,git,Git,我在一个名为new_nlp的分支上,当我执行git状态时,我得到以下信息: # On branch new_nlp # Changed but not updated: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # del

我在一个名为new_nlp的分支上,当我执行git状态时,我得到以下信息:

# On branch new_nlp
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    untitled.
我收到以下错误消息:

cannot rebase: you have unstaged changes
D   untitled.
我看不到这个文件,也不知道如何删除它。我不知道它是怎么加上去的


有人知道我怎样才能通过这个路障吗。我不知道该文件为什么保留在索引中。

使用
git rm untitled将其从索引中删除。
该文件已被删除,并且已被git跟踪。你可以:

  • 删除文件并提交更改(
    git rm--cached untitled;git commit
    )或
  • 运行
    git checkout--untitled
    以取回文件

  • git很可能会抱怨。使用
    --cached
    -f
    选项。我为此挣扎了大约30分钟。
    cannot rebase: you have unstaged changes
    D   untitled.