我有以下工作树状态
$ git status foo/bar.txt
# On branch master
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by us: foo/bar.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
文件foo/bar.txt
在那里,我想再次使其变为“不变状态”(类似于“ svn恢复”):
$ git checkout HEAD foo/bar.txt
error: path 'foo/bar.txt' is unmerged
$ git reset HEAD foo/bar.txt
Unstaged changes after reset:
M foo/bar.txt
现在变得令人困惑:
$ git status foo/bar.txt
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: foo/bar.txt
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: foo/bar.txt
#
两节中的文件相同,新的还是修改的?我该怎么办?
7
我希望有人能解释我们如何陷入这种情况,为什么会发生这种情况,以及为什么解决方案会起作用。
—
Marcos Dione
我遇到了这种情况,因为我在重新设置基准后弹出存储库,这使我陷入了合并冲突(存储库弹出合并)...要解决此问题,我执行了“ checkout --theirs”...。更改仍然存在..删除那些..我再次尝试对文件进行检出..那是我看到上述错误的时候。
—
阿林丹·罗伊休杜里