正如在这个问题中所问的那样,我还想知道如何在git stash pop
不向提交添加所有修改的情况下解决冲突(就像没有冲突的“git stash pop”一样)。
我目前的方法很不酷,因为我是这样做的:
git stash pop # -> CONFLICT
git stash drop
# [resolve conflict]
# [add conflict files]
git reset HEAD # <all files that are in commit-mode>
如何重现:
mkdir foo; cd foo; git init
echo "1" > one
echo "2" > two
git add -A; git commit -m "first"
echo "1.1" > one
echo "2.1" > two
git stash
echo "2.2" > two
git commit -a -m "second"
echo "Only this file would stay in HEAD without the conflict" > third
git add third
git stash pop
git status
2016-06-27:在示例中添加了一个名为“third”的新文件,以表明像 scy 的解决方案这样的变通办法仅适用于空 HEAD,但不能解决 HEAD 没有相同内容的初始问题,例如对于一个git stash pop
没有冲突的。