robmoss / git-is-my-lab-book

Support EMCRs to develop their computing skills
Creative Commons Attribution Share Alike 4.0 International
12 stars 9 forks source link

Use three-way diffs for merge conflicts #45

Closed robmoss closed 11 months ago

robmoss commented 1 year ago

As part of the initial setup instructions, we now set the merge-conflict style to 'diff3', which also shows the original lines. This extra information can help to decide how to best resolve a conflict.

In the first example conflict, it changes the diff from:

diff --cc test.txt
index 18712c4,bc576a6..0000000
--- a/test.txt
+++ b/test.txt
@@@ -1,3 -1,3 +1,7 @@@
  First line
++<<<<<<< ours
 +A different second line
++=======
+ My new second line
++>>>>>>> theirs
  Third line

to:

diff --cc test.txt
index 18712c4,bc576a6..0000000
--- a/test.txt
+++ b/test.txt
@@@ -1,3 -1,3 +1,7 @@@
  First line
++<<<<<<< ours
 +A different second line
++||||||| base
++Second line
++=======
+ My new second line
++>>>>>>> theirs
  Third line
github-actions[bot] commented 1 year ago

PR Preview Action v1.4.4 :---: Preview removed because the pull request was closed. 2023-12-05 23:57 UTC

EamonConway commented 1 year ago

I have provided an additional info section for the --global flag. I think it is important that people know they can change the configuration on a repo by repo basis. I can confirm that this hosts locally successfully. Happy for this to be merged if you agree.

robmoss commented 1 year ago

Very nice, thank you!