Display the Authors and commit message for commits that cause a conflict

给你一囗甜甜゛ 提交于 2019-12-05 01:43:44

You could run git diff --diff-filter=U while merging to see diff output for all (and only) unmerged files. It's still with file content, but it's better than manually running a command for each file.

You can get pretty close very easily:

git ls-files -u \
| while read conflicted; do
        echo @@@ conflicted file $conflicted touched in this merge by:
        git log HEAD...MERGE_HEAD --left-right --format='    %h %aN %s' -- "$conflicted"
done

and really, it's only the right-branch (the one being merged in) commit authors you care about -- the left-branch ones have already been merged, let whoever touched what you've already got sort it out.

Add --topo-order to the log command to list the commits for each branch together.

You need to start using git rerere. You have to resolve the conflict once, but for almost every new rebase the old merge will do it automatically then. Sometimes you'll need to do a git rebase --skip.

https://medium.com/@porteneuve/fix-conflicts-only-once-with-git-rerere-7d116b2cec67

git config --global rerere.enabled true
git config rerere.autoupdate true
mkdir .git/rr-cache

With many coworkers add the .git/rr-cache dir to your project.

ln -s .git/rr-cache .git-rr-cache
git add .git-rr-cache

You may wish to consider using a review tool such as gerrit, which detects possible merge conflicts prior to submitting a change list to a branch. I realize this doesn't help you right this second, but I believe you'll have to write a tool yourself to do what you want.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!