$ git checkout to-branch
$ git merge from-branch
$ git status | grep unmerged
# file1 unmerged
# file2 unmerged
# file3 unmerged
$ vi file1
$ git add .
啊!我本意不是要使用 "git add .",而是想用 "git add file1"!
现在我无法得到以下行为:
$ git show :1:file2
我尝试了:
$ git reset file2
和
$ git checkout -m file2
但是这两个命令都不能将file2返回到“未合并”的状态。git status不会显示它为未合并状态,我也无法访问“git show :1:file2”等命令。我想把文件恢复到未合并的状态。
我如何回到“git add .”之前的状态,但又不失去对file1所做的更改?