【问题标题】:How can I get the same output about merge conflicts as from the merge command?如何获得与合并命令相同的合并冲突输出?
【发布时间】:2015-09-17 00:29:42
【问题描述】:

当我第一次尝试合并但结果有冲突时,我得到了一个非常有用且可读格式的输出:

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 时,它会以其他格式显示合并状态,我个人认为这不太有用。

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

【问题讨论】:

    标签: git merge


    【解决方案1】:

    这是你要找的吗?

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

    我一直在使用各种冲突案例。例如,当一个樱桃挑选失败并在 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
    

    【讨论】:

      猜你喜欢
      • 2016-07-22
      • 2012-12-08
      • 2011-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-25
      • 2019-10-18
      相关资源
      最近更新 更多