@solstice333's answer addresses the problem behind the question but the output still requires a lot of parsing. If you want a quick way to confirm similarities after a rebase, an extension of that solution should help reduce a majority of the clutter.
Solution
hash1=123456 \
hash2=098765 \
sed_command='/^\(diff\|index\|@@\).*$/ d' \
diff <(git show --oneline -U0 $hash1 | sed "$sed_command") <(git show --oneline -U0 $hash2 | sed "$sed_command")
(If you aren't using bash, you can just use the bottom line and replace the variables)
Breaking it down
This command finds the changes from each commit, cleans up the output, and finds the differences in the outputs. The outputs are trimmed down via:
--one-line
- simplifies commit message output
-U0
- shows only the changed lines/removes all surrounding lines; shorthand for --unified=0
;
sed
- Using this command, we reduce clutter in the output by removing any line that starts with certain characters based on the regex (/^\(diff\|index\|@@\).*$/
). Some conditions here can be removed for better specificity but generally do not matter due to the nature of the differences in a rebase.
I suppose you could also extend this to use git diff
in place of the inner git show
commands, to encapsulate all changes in a commit range.