gpt4 book ai didi

git - 如何获得与 merge 命令相同的关于 merge 冲突的输出?

转载 作者:太空狗 更新时间:2023-10-29 13:47:00 24 4
gpt4 key购买 nike

当我第一次尝试 merge 时发现有冲突,我得到了一个非常有用和可读格式的输出:

CONFLICT (rename/delete): Folder/Folder/file.txt deleted in branch_to_merge and renamed in HEAD. Version HEAD of Folder/Folder/file.txt left in tree.
CONFLICT (content): Merge conflict in Folder/Folder/file2.txt

但是,当我之后运行 git statusgit ls-files -u 时,它会以其他格式显示 merge 状态,我个人认为这不太有用。

我可以在不重新启动 merge 过程的情况下再次获得该输出吗?

最佳答案

这是您要找的吗?

git diff --name-only --diff-filter=U

我一直在使用各种冲突案例。例如,当 cherry-pick 因 config.js 中的冲突而失败时,我运行它并获得以下输出:

> git cherry-pick xxxxxxx..yyyyyyy
error: could not apply xxxxxxx... implement feature mmm
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

> git diff --name-only --diff-filter=U
config/config.js

顺便说一句,我在我的 ~/.gitconfig 中为它设置了一个别名 conflict:

[alias]
conflict = diff --name-only --diff-filter=U

关于git - 如何获得与 merge 命令相同的关于 merge 冲突的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31134387/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com