Hi Josef, On 20/12/2017 12:43, Josef Wolf wrote: > >> $ git add -u >> $ git reset > > This would be added after the "git checkout -m -B master FETCH_HEAD" > command? Yes, so it would be something like this: git fetch origin master && #1 git checkout -m -B master FETCH_HEAD && #2 git add -u && #3 git reset #4 But it actually depends on what kind of default `git diff` output you prefer. In order to avoid failure on subsequent script runs, in case where conflicts still exist, you need to ensure #3 and #4 are executed before #1 and #2 are executed _again_. So you may put #3 and #4 in front of #1 and #2, too, that would work just as well, where `git diff` would now be showing "combined diff"[2] as long as the script isn`t executed again (and it would keep showing new "combined diff" from that point on). >> Yes, `git diff` won`t be the same as if conflicts were still in, but >> it might be worth it in this specific case, conflicting parts still >> easily visible between conflict markers. > > That means, the conflict is still there, but git would think this is > an ordinary modification? Yes, as by that `git add -u` you confirm all merge conflicts are resolved, and `git diff` output changes accordingly. You can read more about "diff format for merges"[1] and "combined diff format"[2] from `git-diff`[3] documentation. Here are some examples from my test repositories. Local repo introduces line "A1" (local modification, uncommitted), where remote repo introduced line "B1" (commit). Steps #1 and #2 get executed, merge conflicts shown with `git diff`, before `git add -u` and `git reset`: $ git diff diff --cc A index 5314b4f,1e2b966..0000000 --- a/A +++ b/A @@@ -12,5 -12,5 +12,9 @@@ 2 3 4 ++<<<<<<< FETCH_HEAD +B1 ++======= + A1 ++>>>>>>> local 5 ... and after `git add -u` and `git reset` (note line "B1" not showing as changed anymore): $ git diff diff --git a/A b/A index 5314b4f..8ea9600 100644 --- a/A +++ b/A @@ -12,5 +12,9 @@ A 2 3 4 +<<<<<<< FETCH_HEAD B1 +======= +A1 +>>>>>>> local 5 Now, without any commits yet made locally (except commit pulled from remote repo), local repo adds line "A2" where remote repo introduces line "B2" (commit). Steps #1 and #2 get executed again, merge conflicts shown with `git diff`, before `git add -u` and `git reset`: $ git diff diff --cc A index 424ae9e,4aac880..0000000 --- a/A +++ b/A @@@ -2,7 -2,7 +2,11 @@@ 1 2 3 ++<<<<<<< FETCH_HEAD +B2 ++======= + A2 ++>>>>>>> local 4 5 6 ... and after `git add -u` and `git reset` (note showing line "B2" as unchanged, and now showing leftover "conflicts" around "A1" here as well, where previous "combined" diff discarded it as uninteresting due to implied "--cc"[4] flag): $ git diff diff --git a/A b/A index 424ae9e..77ad8e6 100644 --- a/A +++ b/A @@ -2,7 +2,11 @@ A 1 2 3 +<<<<<<< FETCH_HEAD B2 +======= +A2 +>>>>>>> local 4 5 6 @@ -13,5 +17,9 @@ A3 2 3 4 +<<<<<<< FETCH_HEAD B1 +======= +A1 +>>>>>>> local 5 Hope that helps. As usual, best to give it some try on your own :) Regards, Buga [1] https://git-scm.com/docs/git-diff#_diff_format_for_merges [2] https://git-scm.com/docs/git-diff#_combined_diff_format [3] https://git-scm.com/docs/git-diff [4] https://git-scm.com/docs/git-diff-tree#git-diff-tree---cc