自上次提交以来,当我刚刚对项目中的文件进行了更改时, git stash 工作正常。
但是,如果自上次提交以来我还向项目添加了新文件,则会失败并出现以下错误:
C:\Program Files\Git\cmd\git.exe stash save QtCreator 2013-01-08T12:06:51
无法存储在“C:\MyProject”中:错误:条目“NewFile.cpp”不是最新的。无法合并。
无法保存当前工作树状态
为什么它会显示此错误,如果我已将新文件添加到项目中,是否有办法隐藏我的更改?
编辑
这是输出git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: NewFile.cpp
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: MyFile.cpp
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# MyProject.pro.user