进行手动合并后,是否应该删除提交消息中的冲突列表?

发布于 2024-10-25 06:32:27 字数 195 浏览 9 评论 0原文

假设我运行 git pull ,并且存在 git 无法自动合并的冲突。

在我手动合并更改并运行 git commit 后,我​​是否应该保留 git 在提交中生成的 Conflicts: 部分(作为手动合并这些文件的记录) ,或删除它(因为冲突没有被提交)?

我永远不确定最佳实践是什么 - 警告是为了确保您解决冲突,还是实际记录在提交消息中?

Say I run git pull and there is a conflict that git cannot automatically merge.

After I manually merge the changes, and run git commit, should I leave the Conflicts: section that git generates in the commit (as a record that those files were manually merged), or removed it (as the conflict is not being committed)?

I'm never sure what best practice is - is the warning there to make sure you fix the conflicts, or to be actually logged in the commit message?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

迷雾森÷林ヴ 2024-11-01 06:32:27

这似乎是一个个人意见类型的问题,所以我会回答我的意见[-;

我保留了冲突部分,以提醒大家这次合并产生了冲突。有时我没有正确处理冲突,稍后会产生一些不希望的效果,因此很高兴能够查看提交历史记录并看到文件中存在冲突。

This seems like a personal opinion type of question, so I'll answer with my opinion [-;

I leave the Conflicts section alone as a reminder down the road that this merge produced conflicts. Occasionally I don't handle the conflicts appropriately, and it will produce some undesired effect later, so it's nice to be able to look through the commit history and see that there was a conflict in a file.

聆听风音 2024-11-01 06:32:27

我认为最好的做法是始终描述您为什么要进行提交。当合并冲突时,我会声明你正在合并冲突。但我认为准确列出所有冲突是什么并不重要。始终考虑从现在起两年后重新阅读它:关于您正在承诺的内容,您想要阅读什么。这是很好的一般性建议,无论是关于冲突还是只是功能或错误修复。

I think the best practice is to always describe why you're doing the commit. When merging conflicts, I'd state that you're merging conflicts. But I don't think it's critical to list exactly what all the conflicts are. Always think in terms of re-reading it 2 years from now: what is it you'd want to read about what you're committing. This is good general advice, whether it's about conflicts or just features or bug fixes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文