View already-committed Git merge in external 3-way diff tool -
is there way view merge has been committed in 3-way diff?
if huge merge between branches committed 3 weeks ago, there way can see 3-way diff of in external diff-tool beyondcompare3? i'm looking just files changed in merge commit. bonus if show me conflicts , manually changed, opposed seeing entire difference of file between 2 branches.
i wouldn't mind settling 2-way diff if left side had <<<<< ===== >>>>> conflict markers , right side committed result.
i tried looking @ diff-tree, diff-files, diff, difftool, show, , others , couldn't figure out. know gitk show changes in merge commit not over-under diff view , hard understand when there tons of changes.
if git difftool --cc firstparent..secondparent..result
updated answer: original version of script below flawed in sense $conflicting_files
in fact did not contain files had conflicts, files changed in both parent branches (but not had conflicts). also, not using "the configured merge tool" advertized in rationale, diffuse
. i've addressed both issues in current version of script.
original answer: let's have "master" branch main development going on, , "topic" branch adds feature on top of (older) state of master. saying you're looking files changed in merge commit assume you're interested in changes "topic" introduced "master" in merge commit (including conflict resolution), not in non-conflicting changes done in "master" since "topic" branched. further assuming "master" first parent of merge commit , "topic" second, can achieved with
git difftool <merge commit>^1 <merge commit>
note not make sense use 3-way diff here looking @ state includes conflict resolution. github showing merge commits, way, see e.g. this merge commit have used testing.
to see conflicting files , resolutions in 3-way diff tool came script
#!/bin/sh if [ $# -ne 1 ]; echo "rationale : show conflict resolution of given merge commit in configured merge tool." echo "usage : $(basename $0) <merge commit>" exit -1 fi # test e.g. https://github.com/git/git/commit/8cde60210dd01f23d89d9eb8b6f08fb9ef3a11b8 our=$1^1 their=$1^2 base=$(git merge-base $our $their) conflicting_files=$(git merge-tree $base $our $their | grep -a 3 "changed in both" | grep "base" | grep -po "[^\s]+$") f in $conflicting_files; diffuse -r $our -r $base -r $their $f done
i'm using diffuse instead of beyond compare because first can work directly on git commits opposed local files; change order of arguments liking. use bc, need temporary checkouts; thinking redoing merge, applying known resolution, , run ever git mergetool
configured, both of these ideas require more work not clutter working tree , clean properly.
Comments
Post a Comment