正如这个问题所问,我也想知道如何解决冲突的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
相比,内容不同的初始问题。
git add
命令将冲突解决后的文件加入暂存区,然后希望不再在暂存区中包含它们? - Romaingit stash pop
在没有冲突发生时的行为(但需要通知哪些文件需要合并)。 - Sven