我需要创建预提交钩子来执行项目的一些“完整性测试”(主要检查部署是否没有问题)。 因为我只需要测试即将提交的更改,所以在运行测试之前我需要存储非分阶段更改,并在执行此操作之后弹出存储的更改。但是有一个问题,因为在以下情况下藏匿和指数之间的冲突可能性:Git stash保持索引冲突
比方说,我有以下内容命名testfile
文件:
first line
second line
third line
现在,我将添加之间的线第二和第三
first line
second line
second and a half line
third line
并运行git add
所以它会上演。
现在,我将一前一后添加下一行,因此文件看起来像
first line
second line
second and a half line
second and three quarters line
third line
所以现在第一线和第二线COMMITED,第二个半上演,二,三个季度是不分级的,并第三是承诺。
让我们直接看点。现在,当我运行git stash --keep-index
,然后执行我的测试和试运行git stash pop
,结果如下:
Auto-merging testfile
CONFLICT (content): Merge conflict in testfile
和文件内容是这样的:
first line
second line
second and a half line
<<<<<<< Updated upstream
=======
second and three quarters line
>>>>>>> Stashed changes
third line
我不知道如何重新申请藏运行我的测试后更改并避免此类冲突。我很乐意指出我的正确方向。