I rebased my feature branch over master and want to verify that I resolved all merge conflicts correctly.
I'm using git range-diff for that purpose:
git range-diff --dual-color old-master..origin/my-branch new-master..my-branch
I've read the documentation trice, but still I'm having trouble understanding the output of range-diff. I'd appreciate if someone could help me with that.
I'm having trouble understanding diffs like this
6: 1273567d876 ! 6: 789a6775664 A-commit-message
@@ Commit message
## some/path/something.php ##
@@ some/path/something.php: function initTexts() {
- "text-a",
- "text-b",
- "text-c",
+ "text-x",
+ "text-y",
+ "text-z",
+ "text-added-in-the-commit-a",
+ "text-added-in-the-commit-b",
] as $key) {
Note that
- the first three lines are dimmed and the
-
has a red background, - the next three lines are bold and the
-
has a green background, - and the last two lines are green, with no background
The way I read the documentation
- should indicate a line that was removed in the first commit range
- should indicate a line that was added in the second commit range
- should indicate a line that was added in both commit ranges
What I do not understand
- Why are there even
-
indicators, since no lines were actually deleted. Only new lines were added. The lines with-
are also present in the second range. - Why are
"text-a",
,"text-b",
,"text-c",
,"text-x",
,"text-y",
and"text-z",
in the diff, but not for example"text-unrelated-22",
. - The selection of lines in the diff seems arbitrary to me.
- What should
@@ Commit message
tell me?
More information
First, git show
shows me, that both commits indeed intended to do the same change.
git show 1273567d876
"text-c",
+ "text-added-in-the-commit-a",
+ "text-added-in-the-commit-b",
] as $key) {
git show 789a6775664
"text-z",
+ "text-added-in-the-commit-a",
+ "text-added-in-the-commit-b",
] as $key) {
If I check out the commits under question, we see that both had to apply the changes to different starting situation, which is expected:
git checkout 1273567d876 && (show content of some/path/something.php: function initTexts())10
[…]
"text-unrelated-6",
"text-a",
"text-b",
"text-c",
"text-added-in-the-commit-a",
"text-added-in-the-commit-b",
] as $key) {
git checkout 789a6775664 && (show content of some/path/something.php: function initTexts())
[…]
"text-unrelated-6",
"text-a",
"text-b",
"text-c",
"text-unrelated-7",
[…]
"text-unrelated-22",
"text-x",
"text-y",
"text-z",
"text-added-in-the-commit-a",
"text-added-in-the-commit-b",
] as $key) {
Thanks in advance!