Git:merge 后如何检查是否还存在冲突没有处理

概要

Git:merge 后如何检查是否还存在冲突没有处理

博客

原帖收藏于IT老兵博客

前言

在工作中,遇到一个问题,在git merge后,发生冲突,而当冲突较多的时候,逐个检查冲突,有的时候会遗漏一些文件,导致带有冲突标记的文件上传到了 Git 服务器上,如何解决这个问题呢?

正文

使用以下命令可以快速检查是否还存在有带有冲突标记的文件。
git diff --check

说明:

–check
Warn if changes introduce conflict markers or whitespace errors. What are considered whitespace errors is controlled by core.whitespace configuration. By default, trailing whitespaces (including lines that consist solely of whitespaces) and a space character that is immediately followed by a tab character inside the initial indent of the line are considered whitespace errors. Exits with non-zero status if problems are found. Not compatible with --exit-code.

上文摘录自手册官网,这个命令会检查 conflict markers(冲突标记)和whitespace errors(空格错误)。

总结

Git 是一个相对比较复杂的工具,我发现,复杂往往源自于过于灵活,它的功能非常强大,掌握好了,就可以事半功倍,但是,把它掌握好,是需要花费一些时间成本的。感觉学习 Git,可能需要既需要正面地一篇篇去阅读手册,也需要这样涓涓细流地不断总结各种场景下的用法,也许,这本身就是学习的一种方法。

参考

https://git-scm.com/docs/git-diff
https://ardalis.com/detect-git-conflict-markers

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值