🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
18 messages
18 total messages Started by "Julia Evans via GitGitGadget" Fri, 09 Oct 2026 12:00
[PATCH v2 0/6] [doc] Add new page on merge conflicts
#165
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
372 lines
24337 bytes
Handling merge conflicts is difficult, and currently Git's guidance on merge
conflicts isn't giving users the information they need to navigate the
process. As usual, the process I used to write this was to collect comments
from Git users on the existing documentation, and then address those issues.
I listed the specific issues we're aiming to solve in the first commit
message in the series.

This patch series introduces a new manual page, gitmergeconflicts, which
explains the process of explaining a merge conflict with examples. It also
links to that new page from the commands which can cause merge conflicts,
instead of trying to reexplain the process every time.

Changed in v2:

 * [x] Explain what a merge conflict is (thanks to Junio & Ben)
 * [x] rewrite the "ours" vs "theirs" section (thanks to Patrick for the
   comments)
 * [x] add git log --merge (thanks to Ben)
 * [x] Leave most of the content of git cherry-pick as-is, to make this
   patch set smaller (thanks to Junio)
 * [x] remove the SYNOPSIS since hopefully that won't be required anymore by
   the time this is merged
 * [x] Fix a typo in git revert (s/reverted conflict/reverted commit/)
 * [x] 's/the the/the/' (thanks to Patrick)
 * [x] s/[doc] Thing/doc: thing/ in commit messages (thanks to Tuomas)'
 * [x] squash the commit fixing the linter error (thanks to Junio)
 * [x] list reviewers in Reviewed-by

Some things that we discussed but stayed the same:

 * "git commit does the same thing as git merge --continue" seems to be true
   so we can leave it
 * Don't involve git am and git apply in this.
 * Junio suggested another diff3 example but I feel like there are already a
   lot of examples
 * We've still removed one mention of MERGE_HEAD in the git merge man page
   without replacing it. It's mentioned in other places though.

Thanks to Lobo, Adam Svahn, Louis Vanier, David Turner, Ben Zanin, Salih,
and about 12 others who gave feedback on both the original git merge man
page, as well as the proposed improvements.

Julia Evans (6):
  doc: add new gitmergeconflicts man page
  doc: git-merge: link to new merge conflicts guide
  doc: git-rebase: link to new merge conflicts guide
  doc: git-revert: link to new merge conflicts guide
  doc: git-cherry-pick: link to new merge conflicts guide
  doc: git-pull: link to new merge conflicts guide

 .gitattributes                       |   1 +
 Documentation/Makefile               |   1 +
 Documentation/git-cherry-pick.adoc   |  11 +-
 Documentation/git-merge.adoc         | 125 +---------
 Documentation/git-pull.adoc          |   3 +-
 Documentation/git-rebase.adoc        |  13 +-
 Documentation/git-revert.adoc        |   5 +
 Documentation/gitmergeconflicts.adoc | 333 +++++++++++++++++++++++++++
 Documentation/meson.build            |   1 +
 command-list.txt                     |   1 +
 10 files changed, 362 insertions(+), 132 deletions(-)
 create mode 100644 Documentation/gitmergeconflicts.adoc


base-commit: 3bc0341126508f78f5869cbfc0005e987efdf0c7
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2237%2Fjvns%2Fmerge-conflicts-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2237/jvns/merge-conflicts-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/2237

Range-diff vs v1:

 1:  ad4853dc36 ! 1:  ab0344f947 [doc] Add new gitmergeconflicts man page
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] Add new gitmergeconflicts man page
     +    doc: add new gitmergeconflicts man page
      
          Introduce a new page, `gitmergeconflicts`, that explains the process of
          handling a merge conflict in a way that addresses the following issues,
     @@ Commit message
          interface between similar commands.
      
          Co-Authored-By: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
     +    Reviewed-by: D. Ben Knoble <ben.knoble+github@gmail.com>
     +    Reviewed-by: Patrick Steinhardt <ps@pks.im>
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
     + ## .gitattributes ##
     +@@ .gitattributes: CODE_OF_CONDUCT.md -whitespace
     + /t/oid-info/* text eol=lf
     + /Documentation/git-merge.adoc conflict-marker-size=32
     + /Documentation/git-merge-file.adoc conflict-marker-size=32
     ++/Documentation/gitmergeconflicts.adoc conflict-marker-size=32
     + /Documentation/gitk.adoc conflict-marker-size=32
     + /Documentation/user-manual.adoc conflict-marker-size=32
     + /t/t????-*.sh conflict-marker-size=32
     +
       ## Documentation/Makefile ##
      @@ Documentation/Makefile: MAN7_TXT += gitdiffcore.adoc
       MAN7_TXT += giteveryday.adoc
     @@ Documentation/gitmergeconflicts.adoc (new)
      +----
      +gitmergeconflicts - Guide to handling merge conflicts
      +
     -+
     -+SYNOPSIS
     -+--------
     -+Guide to handling merge conflicts
     -+
     -+
      +DESCRIPTION
      +-----------
      +
     @@ Documentation/gitmergeconflicts.adoc (new)
      +  or `git rebase --abort`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>> below
      +  for how to find the command to run.
      +
     ++WHAT IS A MERGE CONFLICT?
     ++-------------------------
     ++
     ++When Git merges two commits together, it looks at the changes that
     ++each side has made and combines those changes. For example, if one side
     ++edited lines 1-5 of `hello.py` and the other side edited lines 20-25 of
     ++the same file, then it can easily combine them since there's no overlap.
     ++
     ++But if both sides edited overlapping lines of the same file (for example
     ++one side edited lines 1-5 and the other edited lines 3-6), Git will
     ++not try to guess how to combine those changes. This is called a "merge
     ++conflict".
     ++
     ++When this happens, Git shows you both sides' edits and asks you to pick
     ++how to resolve them. It:
     ++
     ++* Stages all of the files which were successfully merged
     ++* For the files with conflicts, it marks them as conflicted, puts both
     ++  sides' edits in the file, and leaves <<markers, merge conflict markers>>
     ++  that you need to resolve.
      +
      +[[markers]]
      +MERGE CONFLICT MARKERS
      +----------------------
      +
     -+Merge conflicts happen when both of the sides being merged edit the same
     -+area of a file. When this happens, Git will update the conflicted file
     ++When there's a merge conflict, Git will update the conflicted file
      +to include merge conflict markers `<<<<<<<`, `=======`, and `>>>>>>>`.
      +For example, here's a merge conflict where both sides edited a list of
      +fruits in different ways:
     @@ Documentation/gitmergeconflicts.adoc (new)
      +   below for how to find the command to run.
      ++
      +Note: During a `git merge`, `git commit` and `git merge --continue` do
     -+the the same thing.
     ++the same thing.
      +
      +
      +[[example]]
     @@ Documentation/gitmergeconflicts.adoc (new)
      +* You can set the configuration option `merge.conflictstyle=diff3`.
      +  See <<diff3,DIFF3 AND ZDIFF3>> below for more.
      +
     ++* `git log --merge -p <filename>`  will list all commits which
     ++  caused the merge conflict for `<filename>`, and the diff
     ++  of how they changed the file.
     ++
      +* Look at the original files.  `git show :1:filename` shows the
      +  common ancestor, `git show :2:filename` shows the "ours"
      +  version, and `git show :3:filename` shows the "theirs"
     @@ Documentation/gitmergeconflicts.adoc (new)
      +"OURS" AND "THEIRS"
      +-------------------
      +
     -+Git refers to the first part of a merge conflict (between `<<<<<<<`
     -+and `=======`) as "ours" and the second part (between `=======` and
     -+`>>>>>>>`) as "theirs".
     ++Sometimes during a merge conflict, Git will use the terms "ours" and
     ++"theirs" (or "us" and "them"). For example, `git status` might say that
     ++a file was `deleted by us`.
      +
     -+Normally, "ours" is the commit that was checked out before you started
     -+the merge, and "theirs" is the other commit.
     ++"Ours" and "theirs" are both commits: "ours" is the current
     ++`HEAD` commit, and "theirs" is the other side being merged.
      +
     -+But when the merge conflict was caused by a `git rebase`, it's the
     -+opposite: "theirs" is the commit that was checked out before you started
     -+the merge. This is because under the hood, `git rebase main` checks out
     -+the `main` commit first before doing the merge operation.
     ++The first part of a merge conflict (between `<<<<<<<` and `=======`) is
     ++from the "ours" side, and the second part (between `=======` and
     ++`>>>>>>>`) is from the "theirs" side.
     ++
     ++----
     ++FRUITS = [
     ++    "apple",
     ++<<<<<<< HEAD
     ++    "cherry",                      <- ours
     ++=======
     ++    "banana",                      <- theirs
     ++>>>>>>> add-fruit
     ++    "mango",
     ++    "orange",
     ++]
     ++----
     ++
     ++During a rebase, it can seem "upside down" because the "ours" commit is
     ++from the branch you're rebasing on (for instance `main` in `git rebase
     ++main`).
      +
      +These terms in Git all mean the same thing when dealing with a merge
      +conflict:
      +
     -+* "common ancestor", "base", and "stage 1"
     -+* "ours", "us", "stage 2", and `HEAD`
     -+* "theirs", "them", and "stage 3"
     ++* "common ancestor" and "base". The files from this commit are "in stage 1".
     ++* "ours", "us", and `HEAD`. The files from this commit are "in stage 2".
     ++* "theirs", "them". The files from this commit are "in stage 3".
     ++
     ++If you're confused about what something like "deleted by us" means, it's
     ++often easiest to use some of the tools from
     ++<<tools,TOOLS FOR HANDLING MERGE CONFLICTS>> above to get more context.
     ++Finding the commit that deleted the file and seeing why is usually more
     ++helpful than trying to abstractly reason through what "us" means.
      +
      +[[automerge]]
     -+Example of using `AUTO_MERGE`
     ++EXAMPLE OF USING `AUTO_MERGE`
      +-----------------------------
      +
      +`git diff AUTO_MERGE` will show what changes you've made so far to
      +resolve conflicts. `AUTO_MERGE` is a reference that Git creates during a
      +merge. It contains the result of running the merge algorithm.
      +
     -+For example, if we resolved the conflict the way we did in the
     -+<<example,example above>>, the diff would look like this:
     ++For example, if we resolved the conflict by adding both "banana" and
     ++"cherry" in order, the diff would look like this:
      +
      +----
      + FRUITS = [
     @@ Documentation/gitmergeconflicts.adoc (new)
      ++    "cherry",
      +     "mango",
      +     "orange",
     -+]
     ++ ]
      +----
      +
      +[NOTE]
     @@ Documentation/meson.build: manpages = {
         'gitnamespaces.adoc' : 7,
         'gitremote-helpers.adoc' : 7,
         'gitrevisions.adoc' : 7,
     +
     + ## command-list.txt ##
     +@@ command-list.txt: githooks                                userinterfaces
     + gitignore                               userinterfaces
     + gitk                                    mainporcelain
     + gitmailmap                              userinterfaces
     ++gitmergeconflicts                       guide
     + gitmodules                              userinterfaces
     + gitnamespaces                           guide
     + gitprotocol-capabilities                developerinterfaces
 2:  a1686a2d82 ! 2:  d5241eb901 [doc] git-merge: link to new merge conflicts guide
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] git-merge: link to new merge conflicts guide
     +    doc: git-merge: link to new merge conflicts guide
      
          All of the info about merge conflicts has been moved to the new guide
      
 3:  128d69e482 ! 3:  72b1207045 [doc] git-rebase: link to new merge conflicts guide
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] git-rebase: link to new merge conflicts guide
     +    doc: git-rebase: link to new merge conflicts guide
      
          Remove some of the detail about how to handle a merge conflict, since
          it's explained in detail in the new guide, and there probably isn't
 4:  ab459231e0 ! 4:  cfa0a8254a [doc] git-revert: link to new merge conflicts guide
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] git-revert: link to new merge conflicts guide
     +    doc: git-revert: link to new merge conflicts guide
      
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
     @@ Documentation/git-revert.adoc: both will discard uncommitted changes in your wor
       See "Reset, restore and revert" in linkgit:git[1] for the differences
       between the three commands.
       
     -+If there have been new commits since the reverted conflict, there may
     ++If there have been new commits since the reverted commit, there may
      +be a merge conflict. See linkgit:gitmergeconflicts[7]
      +(or `git help mergeconflicts`) for a guide to handling merge conflicts.
      +
 5:  03a6b43b58 ! 5:  62b70e9a02 [doc] git-cherry-pick: link to new merge conflicts guide
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] git-cherry-pick: link to new merge conflicts guide
     +    doc: git-cherry-pick: link to new merge conflicts guide
      
          Remove the discussion of merge conflicts and replace it with a link to
          the guide.
     @@ Documentation/git-cherry-pick.adoc: Given one or more existing commits, apply th
       
      -When it is not obvious how to apply a change, the following
      -happens:
     --
     --1. The current branch and `HEAD` pointer stay at the last commit
     --   successfully made.
     --2. The `CHERRY_PICK_HEAD` ref is set to point at the commit that
     --   introduced the change that is difficult to apply, unless the
     --   `--no-commit` option was given.
     --3. Paths in which the change applied cleanly are updated both
     --   in the index file and in your working tree.
     --4. For conflicting paths, the index file records up to three
     --   versions, as described in the "TRUE MERGE" section of
     --   linkgit:git-merge[1].  The working tree files will include
     --   a description of the conflict bracketed by the usual
     --   conflict markers `<<<<<<<` and `>>>>>>>`.
     --5. No other modifications are made.
     --
     --See linkgit:git-merge[1] for some hints on resolving such
     --conflicts.
      +When it is not obvious how to apply a change, there may
      +be a merge conflict. See linkgit:gitmergeconflicts[7]
      +(or `git help mergeconflicts`) for a guide to handling merge conflicts.
     ++
     ++When a merge conflict happens:
       
     + 1. The current branch and `HEAD` pointer stay at the last commit
     +    successfully made.
     +@@ Documentation/git-cherry-pick.adoc: happens:
     +    conflict markers `<<<<<<<` and `>>>>>>>`.
     + 5. No other modifications are made.
     + 
     +-See linkgit:git-merge[1] for some hints on resolving such
     +-conflicts.
     +-
       OPTIONS
       -------
     + <commit>...::
      @@ Documentation/git-cherry-pick.adoc: $ git cherry-pick -Xpatience topic^  <4>
       SEE ALSO
       --------
 6:  d3904f0ca7 ! 6:  ac77db6762 [doc] git-pull: link to new merge conflicts guide
     @@ Metadata
      Author: Julia Evans <julia@jvns.ca>
      
       ## Commit message ##
     -    [doc] git-pull: link to new merge conflicts guide
     +    doc: git-pull: link to new merge conflicts guide
      
          Signed-off-by: Julia Evans <julia@jvns.ca>
      
 7:  4505fdc9a6 < -:  ---------- [doc] ignore conflict markers in gitmergeconflicts.adoc

-- 
gitgitgadget
[PATCH v2 1/6] doc: add new gitmergeconflicts man page
#166
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
434 lines
22477 bytes
From: Julia Evans <julia@jvns.ca>

Introduce a new page, `gitmergeconflicts`, that explains the process of
handling a merge conflict in a way that addresses the following issues,
which came from feedback from Git users on the current explanation of
merge conflicts in the `git merge` man page:

- The process for resolving a merge conflict is only explained in the
  `git merge` man page, even though there are several other commands
  which can result in conflicts
- Sometimes we use "ours" and "theirs" to refer to the two sides of
  the merge conflicts and sometimes we use HEAD and MERGE_HEAD. It should
  be consistent. Also the terms "ours" and "theirs" are not explained.
  Similarly, it says "The part before the `=======` is typically your
  side...", but doesn't explain what "typically" means.
- It introduces the merge format using an analogy to RCS, which very few
  Git users have ever used
- In "The only clean-ups you need are to reset the index file to the
  `HEAD` commit to reverse 2. and to clean up working tree changes made
  by 2. and 3.", it's not clear to users what "2" and "3" are supposed
  to mean
- It uses a cultural reference ("Conflict resolution is hard; let's go
  shopping.") which is confusing or unfamiliar to some people. I think it
  would be clearer for users to use a code example instead.
- It doesn't explain the difference between diff3 and zdiff3
- It sometimes uses the term "area" and sometimes uses the term "hunk"

Also document the unified `--abort`, `--continue` workflow in one
place, since it's a really nice example of a place Git has a consistent
interface between similar commands.

Co-Authored-By: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
Reviewed-by: D. Ben Knoble <ben.knoble+github@gmail.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Julia Evans <julia@jvns.ca>
---
 .gitattributes                       |   1 +
 Documentation/Makefile               |   1 +
 Documentation/gitmergeconflicts.adoc | 333 +++++++++++++++++++++++++++
 Documentation/meson.build            |   1 +
 command-list.txt                     |   1 +
 5 files changed, 337 insertions(+)
 create mode 100644 Documentation/gitmergeconflicts.adoc

diff --git a/.gitattributes b/.gitattributes
index 26490ad60a..0a0fc950b1 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -14,6 +14,7 @@ CODE_OF_CONDUCT.md -whitespace
 /t/oid-info/* text eol=lf
 /Documentation/git-merge.adoc conflict-marker-size=32
 /Documentation/git-merge-file.adoc conflict-marker-size=32
+/Documentation/gitmergeconflicts.adoc conflict-marker-size=32
 /Documentation/gitk.adoc conflict-marker-size=32
 /Documentation/user-manual.adoc conflict-marker-size=32
 /t/t????-*.sh conflict-marker-size=32
diff --git a/Documentation/Makefile b/Documentation/Makefile
index f8dea4b395..bc49641dda 100644
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@ -58,6 +58,7 @@ MAN7_TXT += gitdiffcore.adoc
 MAN7_TXT += giteveryday.adoc
 MAN7_TXT += gitfaq.adoc
 MAN7_TXT += gitglossary.adoc
+MAN7_TXT += gitmergeconflicts.adoc
 MAN7_TXT += gitpacking.adoc
 MAN7_TXT += gitnamespaces.adoc
 MAN7_TXT += gitremote-helpers.adoc
diff --git a/Documentation/gitmergeconflicts.adoc b/Documentation/gitmergeconflicts.adoc
new file mode 100644
index 0000000000..5b0ba1a1de
--- /dev/null
+++ b/Documentation/gitmergeconflicts.adoc
@@ -0,0 +1,333 @@
+gitmergeconflicts(7)
+====================
+
+NAME
+----
+gitmergeconflicts - Guide to handling merge conflicts
+
+DESCRIPTION
+-----------
+
+Merge conflicts can happen during a `git merge`, `git rebase`, `git
+cherry-pick`, `git pull`, or `git revert`. All of those commands use
+the same merge algorithm, and the process for resolving a merge conflict
+is always very similar.
+
+The most common ways to handle a merge conflict are:
+
+* Resolve the conflict. (see <<resolve,HOW TO RESOLVE A MERGE CONFLICT>>
+  below for details)
+* Or stop the operation and return your branch to its original state
+  with the appropriate `--abort` command, for example `git merge --abort`
+  or `git rebase --abort`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>> below
+  for how to find the command to run.
+
+WHAT IS A MERGE CONFLICT?
+-------------------------
+
+When Git merges two commits together, it looks at the changes that
+each side has made and combines those changes. For example, if one side
+edited lines 1-5 of `hello.py` and the other side edited lines 20-25 of
+the same file, then it can easily combine them since there's no overlap.
+
+But if both sides edited overlapping lines of the same file (for example
+one side edited lines 1-5 and the other edited lines 3-6), Git will
+not try to guess how to combine those changes. This is called a "merge
+conflict".
+
+When this happens, Git shows you both sides' edits and asks you to pick
+how to resolve them. It:
+
+* Stages all of the files which were successfully merged
+* For the files with conflicts, it marks them as conflicted, puts both
+  sides' edits in the file, and leaves <<markers, merge conflict markers>>
+  that you need to resolve.
+
+[[markers]]
+MERGE CONFLICT MARKERS
+----------------------
+
+When there's a merge conflict, Git will update the conflicted file
+to include merge conflict markers `<<<<<<<`, `=======`, and `>>>>>>>`.
+For example, here's a merge conflict where both sides edited a list of
+fruits in different ways:
+
+----
+FRUITS = [
+    "apple",
+<<<<<<< HEAD
+    "cherry",
+=======
+    "banana",
+>>>>>>> add-fruit
+    "mango",
+    "orange",
+]
+----
+
+The code from one side of the merge conflict is between `<<<<<<<` and
+`=======`, and the code for the other side is between `=======` and
+`>>>>>>>`. See <<ours,"OURS" AND "THEIRS">> below for a full explanation
+of which side is which.
+
+
+[[resolve]]
+HOW TO RESOLVE A MERGE CONFLICT
+-------------------------------
+
+The process for resolving a merge conflict is:
+
+1. Run `git status` to get a list of files with merge conflicts
+2. For each one, find the conflict markers
+   (the `<<<<<<<`, `=======`, `>>>>>>>`) and edit the code to
+   fix the conflict
+3. Run `git add FILENAME` for each file to mark the conflict as resolved
+4. Run the appropriate `--continue` command to continue the operation
+   that was interrupted by the conflict, for example `git merge --continue`
+   or `git rebase --continue`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>>
+   below for how to find the command to run.
++
+Note: During a `git merge`, `git commit` and `git merge --continue` do
+the same thing.
+
+
+[[example]]
+EXAMPLE OF RESOLVING A MERGE CONFLICT
+-------------------------------------
+
+If you see this in your code during a merge conflict:
+
+----
+FRUITS = [
+    "apple",
+<<<<<<< HEAD
+    "cherry",
+    "mango",
+=======
+    "banana",
+    "mango",
+>>>>>>> add-fruit
+    "orange",
+]
+----
+
+Then you might edit that part of the code like this,
+which includes the fruits from both sides of the conflict:
+
+----
+FRUITS = [
+    "apple",
+    "banana",
+    "cherry",
+    "mango",
+    "orange",
+]
+----
+
+
+[[tools]]
+TOOLS FOR HANDLING MERGE CONFLICTS
+----------------------------------
+
+Here are some ways to get extra context while handling a merge conflict:
+
+* There are many graphical "merge tools" for Git, which will normally
+  show you the different versions of the code side by side.
+  If you have a mergetool configured, `git mergetool` will launch it.
+  See also `merge.tool` in linkgit:git-config[1] for a list of
+  the mergetools Git supports.
+
+* You can set the configuration option `merge.conflictstyle=diff3`.
+  See <<diff3,DIFF3 AND ZDIFF3>> below for more.
+
+* `git log --merge -p <filename>`  will list all commits which
+  caused the merge conflict for `<filename>`, and the diff
+  of how they changed the file.
+
+* Look at the original files.  `git show :1:filename` shows the
+  common ancestor, `git show :2:filename` shows the "ours"
+  version, and `git show :3:filename` shows the "theirs"
+  version.
+
+Here are some ways to track your progress while handling a conflict:
+
+* Use `git status` to get a list of files with conflicts
+
+* Use `git diff --check` to make sure you haven't left any merge
+  conflict markers in a file by accident. It will print "leftover
+  conflict marker" if it finds any.
+
+* Use `git diff AUTO_MERGE` to show what changes you've made so far to
+  resolve the conflicts.
+
+[[git_status]]
+EXAMPLE: GIT STATUS OUTPUT
+--------------------------
+
+When you're in a merge conflict, you can find out what commands to run
+to handle the conflict by running `git status`.
+
+For example, this `git status` output tells you that:
+
+* `git rebase --abort` will safely bring your branch back to its
+  original state
+* you should run `git rebase --continue` when you're done resolving all
+  the conflicts
+* there's one file left with conflicts in it: `fruits.py`
+
+----
+$ git status
+You are currently rebasing branch 'main' on '58a9fcc'.
+  (fix conflicts and then run "git rebase --continue")
+  (use "git rebase --skip" to skip this patch)
+  (use "git rebase --abort" to check out the original branch)
+
+Unmerged paths:
+  (use "git restore --staged <file>..." to unstage)
+  (use "git add <file>..." to mark resolution)
+        both modified:   fruits.py
+----
+
+
+[[diff3]]
+DIFF3 AND ZDIFF3
+----------------
+
+By default, Git doesn't include the original code when formatting
+a merge conflict. To include the original code, you can set the
+configuration option `merge.conflictstyle` to `diff3` or `zdiff3`.
+This extra context can make it much easier to understand what's
+happening in a merge conflict.
+
+Here's an example of what a merge conflict would look like when using
+`diff3`. It shows, in order, the "ours" side of the conflict, the
+original code (`"mangoooo"`), and the "theirs" side of the
+conflict. With this view, you can see that both sides fixed the spelling
+mistake in "mango", and each added one fruit to the list.
+
+----
+FRUITS = [
+    "apple",
+<<<<<<< HEAD
+    "cherry",
+    "mango",
+||||||| 1c22e48
+    "mangoooo",
+=======
+    "banana",
+    "mango",
+>>>>>>> add-fruit
+    "orange",
+]
+----
+
+Here's the same example using `zdiff3`. `zdiff3` takes lines that are
+shared between both sides (the `"mango"` line) and moves them outside
+the conflicted area. This makes the conflicted area shorter, but the
+downside is that it's impossible to tell if `"mango"` was part of the
+original list of fruits or not.
+
+----
+FRUITS = [
+    "apple",
+<<<<<<< HEAD
+    "cherry",
+||||||| 1c22e48
+    "mangoooo",
+=======
+    "banana",
+>>>>>>> add-fruit
+    "mango",
+    "orange",
+]
+----
+
+
+[[ours]]
+"OURS" AND "THEIRS"
+-------------------
+
+Sometimes during a merge conflict, Git will use the terms "ours" and
+"theirs" (or "us" and "them"). For example, `git status` might say that
+a file was `deleted by us`.
+
+"Ours" and "theirs" are both commits: "ours" is the current
+`HEAD` commit, and "theirs" is the other side being merged.
+
+The first part of a merge conflict (between `<<<<<<<` and `=======`) is
+from the "ours" side, and the second part (between `=======` and
+`>>>>>>>`) is from the "theirs" side.
+
+----
+FRUITS = [
+    "apple",
+<<<<<<< HEAD
+    "cherry",                      <- ours
+=======
+    "banana",                      <- theirs
+>>>>>>> add-fruit
+    "mango",
+    "orange",
+]
+----
+
+During a rebase, it can seem "upside down" because the "ours" commit is
+from the branch you're rebasing on (for instance `main` in `git rebase
+main`).
+
+These terms in Git all mean the same thing when dealing with a merge
+conflict:
+
+* "common ancestor" and "base". The files from this commit are "in stage 1".
+* "ours", "us", and `HEAD`. The files from this commit are "in stage 2".
+* "theirs", "them". The files from this commit are "in stage 3".
+
+If you're confused about what something like "deleted by us" means, it's
+often easiest to use some of the tools from
+<<tools,TOOLS FOR HANDLING MERGE CONFLICTS>> above to get more context.
+Finding the commit that deleted the file and seeing why is usually more
+helpful than trying to abstractly reason through what "us" means.
+
+[[automerge]]
+EXAMPLE OF USING `AUTO_MERGE`
+-----------------------------
+
+`git diff AUTO_MERGE` will show what changes you've made so far to
+resolve conflicts. `AUTO_MERGE` is a reference that Git creates during a
+merge. It contains the result of running the merge algorithm.
+
+For example, if we resolved the conflict by adding both "banana" and
+"cherry" in order, the diff would look like this:
+
+----
+ FRUITS = [
+     "apple",
+-<<<<<<< HEAD
+-    "cherry",
+-=======
+     "banana",
+->>>>>>> add-fruit
++    "cherry",
+     "mango",
+     "orange",
+ ]
+----
+
+[NOTE]
+`AUTO_MERGE` is only set if you're using the default Git merge algorithm.
+
+
+SEE ALSO
+--------
+
+linkgit:git-revert[1]
+linkgit:git-merge[1]
+linkgit:git-rebase[1]
+linkgit:git-cherry-pick[1]
+linkgit:git-pull[1]
+linkgit:git-diff[1]
+
+GIT
+---
+
+Part of the linkgit:git[1] suite
diff --git a/Documentation/meson.build b/Documentation/meson.build
index f4854f802d..51647957e0 100644
--- a/Documentation/meson.build
+++ b/Documentation/meson.build
@@ -202,6 +202,7 @@ manpages = {
   'gitfaq.adoc' : 7,
   'gitglossary.adoc' : 7,
   'gitpacking.adoc' : 7,
+  'gitmergeconflicts.adoc' : 7,
   'gitnamespaces.adoc' : 7,
   'gitremote-helpers.adoc' : 7,
   'gitrevisions.adoc' : 7,
diff --git a/command-list.txt b/command-list.txt
index 63ae2a67c9..f6e49c3c85 100644
--- a/command-list.txt
+++ b/command-list.txt
@@ -232,6 +232,7 @@ githooks                                userinterfaces
 gitignore                               userinterfaces
 gitk                                    mainporcelain
 gitmailmap                              userinterfaces
+gitmergeconflicts                       guide
 gitmodules                              userinterfaces
 gitnamespaces                           guide
 gitprotocol-capabilities                developerinterfaces
-- 
gitgitgadget
[PATCH v2 2/6] doc: git-merge: link to new merge conflicts guide
#169
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
162 lines
14380 bytes
From: Julia Evans <julia@jvns.ca>

All of the info about merge conflicts has been moved to the new guide

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-merge.adoc | 125 +----------------------------------
 1 file changed, 3 insertions(+), 122 deletions(-)

diff --git a/Documentation/git-merge.adoc b/Documentation/git-merge.adoc
index a055384ad6..5b7b41cd10 100644
--- a/Documentation/git-merge.adoc
+++ b/Documentation/git-merge.adoc
@@ -49,7 +49,8 @@ a log message from the user describing the changes. Before the operation,
 A merge stops if there's a conflict that cannot be resolved
 automatically or if `--no-commit` was provided when initiating the
 merge. At that point you can run `git merge --abort` or `git merge
---continue`.
+--continue`. See linkgit:gitmergeconflicts[7]
+(or `git help mergeconflicts`) for a guide to handling merge conflicts.
 
 `git merge --abort` will abort the merge process and try to reconstruct
 the pre-merge state. However, if there were uncommitted changes when the
@@ -231,127 +232,6 @@ git merge v1.2.3^0
 git merge --ff-only v1.2.3
 ----
 
-HOW CONFLICTS ARE PRESENTED
----------------------------
-
-During a merge, the working tree files are updated to reflect the result
-of the merge.  Among the changes made to the common ancestor's version,
-non-overlapping ones (that is, you changed an area of the file while the
-other side left that area intact, or vice versa) are incorporated in the
-final result verbatim.  When both sides made changes to the same area,
-however, Git cannot randomly pick one side over the other, and asks you to
-resolve it by leaving what both sides did to that area.
-
-By default, Git uses the same style as the one used by the "merge" program
-from the RCS suite to present such a conflicted hunk, like this:
-
-------------
-Here are lines that are either unchanged from the common
-ancestor, or cleanly resolved because only one side changed,
-or cleanly resolved because both sides changed the same way.
-<<<<<<< yours:sample.txt
-Conflict resolution is hard;
-let's go shopping.
-=======
-Git makes conflict resolution easy.
->>>>>>> theirs:sample.txt
-And here is another line that is cleanly resolved or unmodified.
-------------
-
-The area where a pair of conflicting changes happened is marked with markers
-+<<<<<<<+, `=======`, and +>>>>>>>+.  The part before the `=======`
-is typically your side, and the part afterwards is typically their side.
-
-The default format does not show what the original said in the conflicting
-area.  You cannot tell how many lines are deleted and replaced with
-Barbie's remark on your side.  The only thing you can tell is that your
-side wants to say it is hard and you'd prefer to go shopping, while the
-other side wants to claim it is easy.
-
-An alternative style can be used by setting the `merge.conflictStyle`
-configuration variable to either `diff3` or `zdiff3`.  In `diff3`
-style, the above conflict may look like this:
-
-------------
-Here are lines that are either unchanged from the common
-ancestor, or cleanly resolved because only one side changed,
-<<<<<<< yours:sample.txt
-or cleanly resolved because both sides changed the same way.
-Conflict resolution is hard;
-let's go shopping.
-||||||| base:sample.txt
-or cleanly resolved because both sides changed identically.
-Conflict resolution is hard.
-=======
-or cleanly resolved because both sides changed the same way.
-Git makes conflict resolution easy.
->>>>>>> theirs:sample.txt
-And here is another line that is cleanly resolved or unmodified.
-------------
-
-while in `zdiff3` style, it may look like this:
-
-------------
-Here are lines that are either unchanged from the common
-ancestor, or cleanly resolved because only one side changed,
-or cleanly resolved because both sides changed the same way.
-<<<<<<< yours:sample.txt
-Conflict resolution is hard;
-let's go shopping.
-||||||| base:sample.txt
-or cleanly resolved because both sides changed identically.
-Conflict resolution is hard.
-=======
-Git makes conflict resolution easy.
->>>>>>> theirs:sample.txt
-And here is another line that is cleanly resolved or unmodified.
-------------
-
-In addition to the +<<<<<<<+, `=======`, and +>>>>>>>+ markers, it uses
-another +|||||||+ marker that is followed by the original text.  You can
-tell that the original just stated a fact, and your side simply gave in to
-that statement and gave up, while the other side tried to have a more
-positive attitude.  You can sometimes come up with a better resolution by
-viewing the original.
-
-
-HOW TO RESOLVE CONFLICTS
-------------------------
-
-After seeing a conflict, you can do two things:
-
- * Decide not to merge.  The only clean-ups you need are to reset
-   the index file to the `HEAD` commit to reverse 2. and to clean
-   up working tree changes made by 2. and 3.; `git merge --abort`
-   can be used for this.
-
- * Resolve the conflicts.  Git will mark the conflicts in
-   the working tree.  Edit the files into shape and
-   `git add` them to the index.  Use `git commit` or
-   `git merge --continue` to seal the deal. The latter command
-   checks whether there is a (interrupted) merge in progress
-   before calling `git commit`.
-
-You can work through the conflict with a number of tools:
-
- * Use a mergetool.  `git mergetool` to launch a graphical
-   mergetool which will work through the merge with you.
-
- * Look at the diffs.  `git diff` will show a three-way diff,
-   highlighting changes from both the `HEAD` and `MERGE_HEAD`
-   versions. `git diff AUTO_MERGE` will show what changes you've
-   made so far to resolve textual conflicts.
-
- * Look at the diffs from each branch. `git log --merge -p <path>`
-   will show diffs first for the `HEAD` version and then the
-   `MERGE_HEAD` version.
-
- * Look at the originals.  `git show :1:filename` shows the
-   common ancestor, `git show :2:filename` shows the `HEAD`
-   version, and `git show :3:filename` shows the `MERGE_HEAD`
-   version.
-
-
 EXAMPLES
 --------
 
@@ -406,6 +286,7 @@ linkgit:git-reset[1],
 linkgit:git-diff[1], linkgit:git-ls-files[1],
 linkgit:git-add[1], linkgit:git-rm[1],
 linkgit:git-mergetool[1]
+linkgit:gitmergeconflicts[7]
 
 GIT
 ---
-- 
gitgitgadget
[PATCH v2 3/6] doc: git-rebase: link to new merge conflicts guide
#171
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
55 lines
9984 bytes
From: Julia Evans <julia@jvns.ca>

Remove some of the detail about how to handle a merge conflict, since
it's explained in detail in the new guide, and there probably isn't
enough detail anyway.

Leave the steps since rebase is special and has a `--skip` option which
the other commands which cause merge conflicts don't have.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-rebase.adoc | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-rebase.adoc b/Documentation/git-rebase.adoc
index f6c22d1598..da70aff498 100644
--- a/Documentation/git-rebase.adoc
+++ b/Documentation/git-rebase.adoc
@@ -46,10 +46,7 @@ If there is a merge conflict during this process, `git rebase` will stop at the
 first problematic commit and leave conflict markers. If this happens, you can do
 one of these things:
 
-1. Resolve the conflict. You can use `git diff` to find the markers (<<<<<<)
-   and make edits to resolve the conflict. For each file you edit, you need to
-   tell Git that the conflict has been resolved. You can mark the conflict as
-   resolved with  `git add <filename>`. After resolving all of the conflicts,
+1. Resolve the conflict. After resolving all of the conflicts,
    you can continue the rebasing process with
 
    git rebase --continue
@@ -62,6 +59,9 @@ one of these things:
 
    git rebase --skip
 
+See linkgit:gitmergeconflicts[7] (or `git help mergeconflicts`)
+for a full guide to handling merge conflicts.
+
 If you don't specify an `<upstream>` to rebase onto, the upstream configured in
 `branch.<name>.remote` and `branch.<name>.merge` options will be used (see
 linkgit:git-config[1] for details) and the `--fork-point` option is
@@ -1284,6 +1284,11 @@ include::includes/cmd-config-section-all.adoc[]
 include::config/rebase.adoc[]
 include::config/sequencer.adoc[]
 
+SEE ALSO
+--------
+
+linkgit:gitmergeconflicts[7]
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
gitgitgadget
[PATCH v2 4/6] doc: git-revert: link to new merge conflicts guide
#170
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
33 lines
8900 bytes
From: Julia Evans <julia@jvns.ca>

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-revert.adoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/git-revert.adoc b/Documentation/git-revert.adoc
index ffba365e63..1edf98b9aa 100644
--- a/Documentation/git-revert.adoc
+++ b/Documentation/git-revert.adoc
@@ -31,6 +31,10 @@ both will discard uncommitted changes in your working directory.
 See "Reset, restore and revert" in linkgit:git[1] for the differences
 between the three commands.
 
+If there have been new commits since the reverted commit, there may
+be a merge conflict. See linkgit:gitmergeconflicts[7]
+(or `git help mergeconflicts`) for a guide to handling merge conflicts.
+
 OPTIONS
 -------
 <commit>...::
@@ -162,6 +166,7 @@ include::config/revert.adoc[]
 SEE ALSO
 --------
 linkgit:git-cherry-pick[1]
+linkgit:gitmergeconflicts[7]
 
 GIT
 ---
-- 
gitgitgadget
[PATCH v2 5/6] doc: git-cherry-pick: link to new merge conflicts guide
#167
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
49 lines
9465 bytes
From: Julia Evans <julia@jvns.ca>

Remove the discussion of merge conflicts and replace it with a link to
the guide.

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-cherry-pick.adoc | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-cherry-pick.adoc b/Documentation/git-cherry-pick.adoc
index f4cd8b9db7..1834167287 100644
--- a/Documentation/git-cherry-pick.adoc
+++ b/Documentation/git-cherry-pick.adoc
@@ -19,8 +19,11 @@ Given one or more existing commits, apply the change each one
 introduces, recording a new commit for each.  This requires your
 working tree to be clean (no modifications from the HEAD commit).
 
-When it is not obvious how to apply a change, the following
-happens:
+When it is not obvious how to apply a change, there may
+be a merge conflict. See linkgit:gitmergeconflicts[7]
+(or `git help mergeconflicts`) for a guide to handling merge conflicts.
+
+When a merge conflict happens:
 
 1. The current branch and `HEAD` pointer stay at the last commit
    successfully made.
@@ -36,9 +39,6 @@ happens:
    conflict markers `<<<<<<<` and `>>>>>>>`.
 5. No other modifications are made.
 
-See linkgit:git-merge[1] for some hints on resolving such
-conflicts.
-
 OPTIONS
 -------
 <commit>...::
@@ -259,6 +259,7 @@ $ git cherry-pick -Xpatience topic^  <4>
 SEE ALSO
 --------
 linkgit:git-revert[1]
+linkgit:gitmergeconflicts[7]
 
 GIT
 ---
-- 
gitgitgadget
[PATCH v2 6/6] doc: git-pull: link to new merge conflicts guide
#168
Author: "Julia Evans via GitGitGadget"
Date: Fri, 09 Oct 2026 12:00
24 lines
8715 bytes
From: Julia Evans <julia@jvns.ca>

Signed-off-by: Julia Evans <julia@jvns.ca>
---
 Documentation/git-pull.adoc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
index 88f4fd3926..73f6d460bb 100644
--- a/Documentation/git-pull.adoc
+++ b/Documentation/git-pull.adoc
@@ -38,7 +38,8 @@ or `pull.ff` with your preferred behaviour.
 
 If there's a merge conflict during the merge or rebase that you don't
 want to handle, you can safely abort it with `git merge --abort` or
-`git rebase --abort`.
+`git rebase --abort`. See linkgit:gitmergeconflicts[7]
+(or `git help mergeconflicts`) for a guide to handling merge conflicts.
 
 OPTIONS
 -------
-- 
gitgitgadget
Re: [PATCH v2 0/6] [doc] Add new page on merge conflicts
#198
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 15:41
64 lines
12249 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  * [x] list reviewers in Reviewed-by

We may have a bit of misunderstanding in the process regarding this.

. `Reviewed-by:`, unlike the other trailers, can only be offered by the
  reviewers themselves when they are completely satisfied with the
  patch after a detailed analysis.

is how SubmittingPatches describes it.

ReviewingGuidelines.adoc tells reviewers

  If you are happy with the state of the patch series, explicitly
  indicate your approval (typically with a reply to the latest
  version's cover letter). Optionally, you can let the author know
  that they can add a "Reviewed-by: <you>" trailer if they resubmit
  the reviewed patch verbatim in a later iteration of the series.

For example, you added Ben and Patrick to the trailer of patch #1.

> Range-diff vs v1:
>
>  1:  ad4853dc36 ! 1:  ab0344f947 [doc] Add new gitmergeconflicts man page
>      @@ Metadata
>       Author: Julia Evans <julia@jvns.ca>
>       
>        ## Commit message ##
>      -    [doc] Add new gitmergeconflicts man page
>      +    doc: add new gitmergeconflicts man page
> ...
>           Co-Authored-By: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
>      +    Reviewed-by: D. Ben Knoble <ben.knoble+github@gmail.com>
>      +    Reviewed-by: Patrick Steinhardt <ps@pks.im>
>           Signed-off-by: Julia Evans <julia@jvns.ca>

Going back to the review thread of the previous round of this patch,
https://lore.kernel.org/git/ar3sGzEknG2_Un_E@pks.im/

2026-09-24 14:44 ` [PATCH 1/7] [doc] Add new gitmergeconflicts man page Julia Evans via GitGitGadget
2026-09-24 20:36   ` Junio C Hamano
2026-09-24 22:04     ` Junio C Hamano
2026-09-30 13:19   ` Patrick Steinhardt
2026-09-30 19:53     ` Julia Evans
2026-09-30 20:37       ` Junio C Hamano
2026-10-01  5:14         ` Patrick Steinhardt [this message]
2026-10-01 12:10           ` Julia Evans
2026-10-02 17:58         ` Junio C Hamano
2026-10-05 16:54       ` Julia Evans
2026-10-05 17:22         ` Junio C Hamano
2026-10-05 19:11           ` Julia Evans

There are many messages that reply to the cover letter of the same
iteration by Ben that gave a lot of good input, and I know Patrick
also helped during the discussion to improve the document.  I do not
think neither of them said anything about reviewed-by.

We do want to credit the reviewers of previous rounds for their
input that contributed to improvements in the latest round.  But the
way to do so is by mentioning them on "Helped-by:" you add.

Thanks.
Re: [PATCH v2 1/6] doc: add new gitmergeconflicts man page
#197
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 17:58
575 lines
32603 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> Introduce a new page, `gitmergeconflicts`, that explains the process of
> handling a merge conflict in a way that addresses the following issues,
> which came from feedback from Git users on the current explanation of
> merge conflicts in the `git merge` man page:

Good goal.

> - The process for resolving a merge conflict is only explained in the
>   `git merge` man page, even though there are several other commands
>   which can result in conflicts
> - Sometimes we use "ours" and "theirs" to refer to the two sides of
>   the merge conflicts and sometimes we use HEAD and MERGE_HEAD. It should
>   be consistent. Also the terms "ours" and "theirs" are not explained.
>   Similarly, it says "The part before the `=======` is typically your
>   side...", but doesn't explain what "typically" means.
> - It introduces the merge format using an analogy to RCS, which very few
>   Git users have ever used
> - In "The only clean-ups you need are to reset the index file to the
>   `HEAD` commit to reverse 2. and to clean up working tree changes made
>   by 2. and 3.", it's not clear to users what "2" and "3" are supposed
>   to mean
> - It uses a cultural reference ("Conflict resolution is hard; let's go
>   shopping.") which is confusing or unfamiliar to some people. I think it
>   would be clearer for users to use a code example instead.
> - It doesn't explain the difference between diff3 and zdiff3
> - It sometimes uses the term "area" and sometimes uses the term "hunk"

It is a bit hard to evaluate this list, as we do not see any of the
above problems excised from the existing documents in this step.
But at least we can verify that the new text presented in this patch
does not fall into the same trap as above, so I'll keep that in mind
while reviewing this step.

> Also document the unified `--abort`, `--continue` workflow in one
> place, since it's a really nice example of a place Git has a consistent
> interface between similar commands.

Great.

> Co-Authored-By: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
> Reviewed-by: D. Ben Knoble <ben.knoble+github@gmail.com>
> Reviewed-by: Patrick Steinhardt <ps@pks.im>
> Signed-off-by: Julia Evans <julia@jvns.ca>

We want a sign-off by the coauthor, too.

> diff --git a/Documentation/gitmergeconflicts.adoc b/Documentation/gitmergeconflicts.adoc
> new file mode 100644
> index 0000000000..5b0ba1a1de
> --- /dev/null
> +++ b/Documentation/gitmergeconflicts.adoc
> @@ -0,0 +1,333 @@
> +gitmergeconflicts(7)
> +====================
> +
> +NAME
> +----
> +gitmergeconflicts - Guide to handling merge conflicts
> +
> +DESCRIPTION
> +-----------
> +
> +Merge conflicts can happen during a `git merge`, `git rebase`, `git
> +cherry-pick`, `git pull`, or `git revert`. All of those commands use
> +the same merge algorithm, and the process for resolving a merge conflict
> +is always very similar.

Is it deliberate to omit 'am -3' and 'checkout -m', perhaps in order
tolimit ourselves to most common ways to help new people by keeping
the description to the absolute minimum?

Or were they just overlooked?

In any case, the first paragraph clearly stating that conflicts
happen with operations other than 'merge' is a very welcome change.
On this list, we often say "mergy operations can cause conflicts",
with the understanding that readers know what mergy operations are
and "conflicts" alone can convey the state you call "merge
conflicts" in this document.  But in a document for end-users, using
a longer term "merge conflicts" instead of "conflicts" and avoiding
"mergy operations" like you did above may be a better direction to
go.

> +The most common ways to handle a merge conflict are:

A natural paraphrase of the above is "A merge conflict is typically
handled by these ways", but I thought the current readers are
puzzled by "typically your side" that does not say when is typical.

> +* Resolve the conflict. (see <<resolve,HOW TO RESOLVE A MERGE CONFLICT>>
> +  below for details)
> +* Or stop the operation and return your branch to its original state
> +  with the appropriate `--abort` command, for example `git merge --abort`
> +  or `git rebase --abort`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>> below
> +  for how to find the command to run.

Both are good options and I do not think of a middle way.  Perhaps
we do not have to say that these are "the most common" and instead
say "You handle a merge conflict by doing either of these two"?

Saying "return your branch to" is a bit misleading for two reasons.
Conflicts presented to the users are primarily visible in their
working tree files and the index.  A single commit operations like
'merge', 'pull', and 'revert' does not touch your branch if they hit
a conflict, and 'rebase' works on a detached HEAD, and stops without
touching your branch when it sees a conflict.

If I were writing this, with the goal of avoiding the issues the
current text has you listed in the proposed log message, I would
probably say something like this:

 * Or give up and return to the original state with ...

> +WHAT IS A MERGE CONFLICT?
> +-------------------------
> +
> +When Git merges two commits together, it looks at the changes that
> +each side has made and combines those changes. For example, if one side
> +edited lines 1-5 of `hello.py` and the other side edited lines 20-25 of
> +the same file, then it can easily combine them since there's no overlap.

Many of the operations, even "git merge", is not about merging "two
commits" together, but I do not think of a good way to explain it,
so I accept that phrasing as a helpful white lie.  I mention this
because somebody else may be able to come up with a better phrasing
that I (or authors of this iteration) couldn't think of.

> +But if both sides edited overlapping lines of the same file (for example
> +one side edited lines 1-5 and the other edited lines 3-6), Git will
> +not try to guess how to combine those changes. This is called a "merge
> +conflict".
> +
> +When this happens, Git shows you both sides' edits and asks you to pick
> +how to resolve them. It:
> +
> +* Stages all of the files which were successfully merged
> +* For the files with conflicts, it marks them as conflicted, puts both
> +  sides' edits in the file, and leaves <<markers, merge conflict markers>>
> +  that you need to resolve.

By the way, I think we should briefly mention what sematnic merge
conflicts are, and that Git does not detect them and that this
manual page does not tell readers how to deal with them.
    
    Note that non-overlapping changes from two sides may leave the
    result in an inconsistent state.  With the edit to lines 1-5,
    one side may have changed the name of a function, while with the
    edit to lines 20-25, the other side may have added a new call to
    the function by its original name.  This type of inconsistencies
    are called semantic conflicts, Git has no way knowing that a
    merge introduced semantic conflicts, and ends up producing a
    broken result without merge conflicts.  This document does not
    cover what to do with semantic conflicts.

That is overly long, but perhaps you can condense it down to the
essense and shrink down to 1/3 of the size.

> +[[markers]]
> +MERGE CONFLICT MARKERS
> +----------------------
> +
> +When there's a merge conflict, Git will update the conflicted file
> +to include merge conflict markers `<<<<<<<`, `=======`, and `>>>>>>>`.

I notice that when you introduce `diff3` below, you silently add
`|||||||` to the mix without explaining what it is.

    `|||||||` may also be used as merge conflict markers (explained
    later).

or something along the line here may help.  Or explain what it is in
`diff3` section.  Either would work.  Adding without explanation
would not.

> +For example, here's a merge conflict where both sides edited a list of
> +fruits in different ways:
> +
> +----
> +FRUITS = [
> +    "apple",
> +<<<<<<< HEAD
> +    "cherry",
> +=======
> +    "banana",
> +>>>>>>> add-fruit
> +    "mango",
> +    "orange",
> +]
> +----
> +
> +The code from one side of the merge conflict is between `<<<<<<<` and
> +`=======`, and the code for the other side is between `=======` and
> +`>>>>>>>`. See <<ours,"OURS" AND "THEIRS">> below for a full explanation
> +of which side is which.

If we said "one side wanted to have 'apple, cherry, mango, orange',
while the other side wanted 'apply, banana, mango, orange', in the
FRUITS array", would it help the understanding?  Or is it too
obvious?

> +[[resolve]]
> +HOW TO RESOLVE A MERGE CONFLICT
> +-------------------------------
> +
> +The process for resolving a merge conflict is:
> +
> +1. Run `git status` to get a list of files with merge conflicts
> +2. For each one, find the conflict markers
> +   (the `<<<<<<<`, `=======`, `>>>>>>>`) and edit the code to
> +   fix the conflict
> +3. Run `git add FILENAME` for each file to mark the conflict as resolved
> +4. Run the appropriate `--continue` command to continue the operation
> +   that was interrupted by the conflict, for example `git merge --continue`
> +   or `git rebase --continue`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>>
> +   below for how to find the command to run.
> ++
> +Note: During a `git merge`, `git commit` and `git merge --continue` do
> +the same thing.
> +
> +
> +[[example]]
> +EXAMPLE OF RESOLVING A MERGE CONFLICT
> +-------------------------------------
> +
> +If you see this in your code during a merge conflict:
> +
> +----
> +FRUITS = [
> +    "apple",
> +<<<<<<< HEAD
> +    "cherry",
> +    "mango",
> +=======
> +    "banana",
> +    "mango",
> +>>>>>>> add-fruit
> +    "orange",
> +]
> +----

It would make your readers puzzled why the example is subtly
different from the earlier one that showed "mango" as not touched by
either side.  I see this lays the groundwork for later demonstration
of `diff3`, so having both sides explicitly want "mango" is a good
example.  Perhaps update the first example to be the same as this
one, which would reduce the mental burden by readers?

> +
> +Then you might edit that part of the code like this,
> +which includes the fruits from both sides of the conflict:
> +
> +----
> +FRUITS = [
> +    "apple",
> +    "banana",
> +    "cherry",
> +    "mango",
> +    "orange",
> +]
> +----

OK.

> +[[tools]]
> +TOOLS FOR HANDLING MERGE CONFLICTS
> +----------------------------------
> +
> +Here are some ways to get extra context while handling a merge conflict:
> +
> +* There are many graphical "merge tools" for Git, which will normally
> +  show you the different versions of the code side by side.
> +  If you have a mergetool configured, `git mergetool` will launch it.
> +  See also `merge.tool` in linkgit:git-config[1] for a list of
> +  the mergetools Git supports.
> +
> +* You can set the configuration option `merge.conflictstyle=diff3`.
> +  See <<diff3,DIFF3 AND ZDIFF3>> below for more.

These are called 'configuration variables' throughout the manual
pages.  Be consistent and replace "configuration option" with
"configuration variable", perhaps?

> +* `git log --merge -p <filename>`  will list all commits which
> +  caused the merge conflict for `<filename>`, and the diff
> +  of how they changed the file.

Maybe worth mentioning that `--left-right` often helps when you are
not super familiar with the histories being merged.

> +* Look at the original files.  `git show :1:filename` shows the
> +  common ancestor, `git show :2:filename` shows the "ours"
> +  version, and `git show :3:filename` shows the "theirs"
> +  version.

Maybe it will help to say we will explain "ours" and "theirs" later
in this document.

> +Here are some ways to track your progress while handling a conflict:
> +
> +* Use `git status` to get a list of files with conflicts
> +
> +* Use `git diff --check` to make sure you haven't left any merge
> +  conflict markers in a file by accident. It will print "leftover
> +  conflict marker" if it finds any.

Good.  This also complains about whitespace errors, by the way, but
the last sentence here would be sufficient to help the readers to
tell them apart.

> +* Use `git diff AUTO_MERGE` to show what changes you've made so far to
> +  resolve the conflicts.

Does a "See below" here help readers who haven't learned what
AUTO_MERGE is?  If you can describe what AUTO_MERGE records (in
other words, what you are comparing your progress against) in a
sentence of two here, that would alleviate the need to assure them
that we have more in-depth coverage on this topic elsewhere.

> +[[git_status]]
> +EXAMPLE: GIT STATUS OUTPUT
> +--------------------------
> +
> +When you're in a merge conflict, you can find out what commands to run
> +to handle the conflict by running `git status`.
> +
> +For example, this `git status` output tells you that:
> +
> +* `git rebase --abort` will safely bring your branch back to its
> +  original state
> +* you should run `git rebase --continue` when you're done resolving all
> +  the conflicts
> +* there's one file left with conflicts in it: `fruits.py`

There may be users, after seeing the last point, left puzzled why
fruits.py is still listed after they edited the file like instructed
in an earlier example but haven't marked the resolution.

    `fruits.py` is not marked as its conflicts resolved yet.

or something?

> +----
> +$ git status
> +You are currently rebasing branch 'main' on '58a9fcc'.
> +  (fix conflicts and then run "git rebase --continue")
> +  (use "git rebase --skip" to skip this patch)
> +  (use "git rebase --abort" to check out the original branch)
> +
> +Unmerged paths:
> +  (use "git restore --staged <file>..." to unstage)
> +  (use "git add <file>..." to mark resolution)
> +        both modified:   fruits.py
> +----

The approach to give explanations first and then an example the
explanation explains next is refreshing to me.  As long as the
explanations are short enough, this may work better than the usual
order to say "you'd see something like this. let us explain ...".

> +[[diff3]]
> +DIFF3 AND ZDIFF3
> +----------------
> +
> +By default, Git doesn't include the original code when formatting
> +a merge conflict. To include the original code, you can set the
> +configuration option `merge.conflictstyle` to `diff3` or `zdiff3`.
> +This extra context can make it much easier to understand what's
> +happening in a merge conflict.

I think most on the list considers `zdiff3` a failed experiment that
reduces usefulness of `diff3`.  Do we want to recommend it?

Is it obvious to readers what "original" we are talking about?  We
are not talking about the state we started the mergy operation from.
We are talking about what the common ancestor had before two sides
started working on the text to cause the divergence that conflicted.

One way I can think of to resolve this is to back to "What is a
merge conflict?" section and introduce "original" right there.  I'll
SHOUT my additions below:

    When Git merges two commits together, it looks at the changes
    that each side has made SINCE THE TWO SIDES DIVERGED and
    combines those changes.  WE OFTEN CALL THIS STATE THEY DIVERGED
    FROM THE "ORIGINAL".  For example, if one side edited lines 1-5
    of `hello.py` and the other side edited lines 20-25 of the same
    file, then it can easily combine them since there's no overlap.

If you later use "common" or "common ancestor", you can explain they
are "original" we defined in the above paragraph.

Or ...

> +Here's an example of what a merge conflict would look like when using
> +`diff3`. It shows, in order, the "ours" side of the conflict, the
> +original code (`"mangoooo"`), and the "theirs" side of the
> +conflict. With this view, you can see that both sides fixed the spelling
> +mistake in "mango", and each added one fruit to the list.

... perhaps you avoid "common ancestor" altogether, with the
intention to deprecate it, and introduce "original", like in the
above paragraph?  That is fine too.  Once we establish what to call
"common, ours, theirs", we should add them to glossary-contents, as
I do not think we describe any of the ones we currently use there.

As I already mentioned, just like you said <<< === encloses your
side and === >>> encloses their side in 2-way conflict display,
we need to say <<< ||| encloses yours and ||| === encloses common
in diff3 output.  How theirs is shown remains the same.  Here is my
attempt to do so with least disruption to the flow of the text.

    Here is an example of what the same conflict might look with
    `diff3`.  It uses a new separator `|||||||` before `=======`,
    and shows, in order the "ours" side ...

> +----
> +FRUITS = [
> +    "apple",
> +<<<<<<< HEAD
> +    "cherry",
> +    "mango",
> +||||||| 1c22e48
> +    "mangoooo",
> +=======
> +    "banana",
> +    "mango",
> +>>>>>>> add-fruit
> +    "orange",
> +]
> +----
> +
> +Here's the same example using `zdiff3`. `zdiff3` takes lines that are
> +shared between both sides (the `"mango"` line) and moves them outside
> +the conflicted area. This makes the conflicted area shorter, but the
> +downside is that it's impossible to tell if `"mango"` was part of the
> +original list of fruits or not.

Yes, exactly.  That is why I think we shouldn't promote it, but
write it off as a failed experiment, and just tell them not to use
it in this document, without giving an example.

If the original were "apple, banana, cherry, mangoooo, orange", and
ours and theirs were the same as the above example, then a desirable
conflict resolution would be "apple, mango, orange", because both
sides knew the original had banana and cherry, and each side
rejected one of them each.  It would be a good demonstration of why
`diff3` is a better format than `(rcs)merge`, so if we were to spend
lines on an example, I'd rather see it here, instead of zdiff3 example.

By the way, is it just me who finds those "Here's", "there's"
contractions disturbing in an official manual?  I've seen many of
them while reviewing this to be annoyed enough and had to blurt it
out X-<.

> +[[ours]]
> +"OURS" AND "THEIRS"
> +-------------------
> +
> +Sometimes during a merge conflict, Git will use the terms "ours" and
> +"theirs" (or "us" and "them"). For example, `git status` might say that
> +a file was `deleted by us`.

OK.

> +"Ours" and "theirs" are both commits: "ours" is the current
> +`HEAD` commit, and "theirs" is the other side being merged.

Now, "commits" is again a white lie.  The story becomes more
complicated when we talk about cherry-pick and revert, but if we
primarily stick to what happens in 'merge' (which is what I've seen
so far in this document), then it shouldn't add any extra difficulty
to understand by saying "ours and theirs are history of changes
leading to the two commits since they diverged from the original" to
add clarity.

> +The first part of a merge conflict (between `<<<<<<<` and `=======`) is
> +from the "ours" side, and the second part (between `=======` and
> +`>>>>>>>`) is from the "theirs" side.
> +
> +----
> +FRUITS = [
> +    "apple",
> +<<<<<<< HEAD
> +    "cherry",                      <- ours
> +=======
> +    "banana",                      <- theirs
> +>>>>>>> add-fruit
> +    "mango",
> +    "orange",
> +]
> +----
> +
> +During a rebase, it can seem "upside down" because the "ours" commit is
> +from the branch you're rebasing on (for instance `main` in `git rebase
> +main`).
> +
> +These terms in Git all mean the same thing when dealing with a merge
> +conflict:
> +
> +* "common ancestor" and "base". The files from this commit are "in stage 1".
> +* "ours", "us", and `HEAD`. The files from this commit are "in stage 2".
> +* "theirs", "them". The files from this commit are "in stage 3".
> +
> +If you're confused about what something like "deleted by us" means, it's
> +often easiest to use some of the tools from
> +<<tools,TOOLS FOR HANDLING MERGE CONFLICTS>> above to get more context.
> +Finding the commit that deleted the file and seeing why is usually more
> +helpful than trying to abstractly reason through what "us" means.
> +
> +[[automerge]]
> +EXAMPLE OF USING `AUTO_MERGE`
> +-----------------------------
> +
> +`git diff AUTO_MERGE` will show what changes you've made so far to
> +resolve conflicts. `AUTO_MERGE` is a reference that Git creates during a
> +merge. It contains the result of running the merge algorithm.

The first sentence gave me "Huh?  You haven't explained what
AUTO_MERGE is yet".  It may be just me, but I would have expected
presentation order to be more like:

    When merge conflicts happen, the result of merge algorithm,
    together with conflict markers, is recorded in AUTO_MERGE.  As
    you resolve conflicts, you can compare your working tree files
    against it with `git diff AUTO_MERGE` to see your progress.

> +For example, if we resolved the conflict by adding both "banana" and
> +"cherry" in order, the diff would look like this:
> +
> +----
> + FRUITS = [
> +     "apple",
> +-<<<<<<< HEAD
> +-    "cherry",
> +-=======
> +     "banana",
> +->>>>>>> add-fruit
> ++    "cherry",
> +     "mango",
> +     "orange",
> + ]
> +----

Thanks.


I was puzzled by this

> - In "The only clean-ups you need are to reset the index file to the
>   `HEAD` commit to reverse 2. and to clean up working tree changes made
>   by 2. and 3.", it's not clear to users what "2" and "3" are supposed
>   to mean

and did some digging.

The text comes from ffb1a4bed5 (Documentation: Describe merge
operation a bit better., 2005-11-28) that had "When there are
conflicts, these things happen. 1. HEAD does not move, 2. Cleanly
merged paths are updated in the index 3. Conflicts are recorded in
higher stage index entries and working tree files show conflict
markers, 4. No other changes are done" well before the mysterious
reference to 2. and 3.

When ebef7e5049 (Documentation: simplify How Merge Works,
2010-01-23) tried to simplify the description, the list of "these
things happen" were removed/rewritten, and yet instructions on how
to reset are left behind, still referring to 2. and 3.

We probably want a separate patch for Documentation/git-merge.adoc
to rectify this 16 year old mistake.
Re: [PATCH v2 2/6] doc: git-merge: link to new merge conflicts guide
#203
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:20
139 lines
15895 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> All of the info about merge conflicts has been moved to the new guide

In the body text end the sentence with a full stop.

And I just went though the "new guide" with fine toothed comb, I am
very much qualified to judge if the above claim is correct.  Let's
see.

> @@ -231,127 +232,6 @@ git merge v1.2.3^0
>  git merge --ff-only v1.2.3
>  ----
>  
> -HOW CONFLICTS ARE PRESENTED
> ----------------------------
> -
> -During a merge, the working tree files are updated to reflect the result
> -of the merge.  Among the changes made to the common ancestor's version,
> -non-overlapping ones (that is, you changed an area of the file while the
> -other side left that area intact, or vice versa) are incorporated in the
> -final result verbatim.  When both sides made changes to the same area,
> -however, Git cannot randomly pick one side over the other, and asks you to
> -resolve it by leaving what both sides did to that area.

OK.  We said working tree files are updated.  We made a weak
reference to "common ancestor" but with my suggested updates I think
we sufficiently cover this.  "Git cannot ... and asks you ..." had a
nice nuance that we may not have captured in the new document (we
stop at "will not try to guess" and say "asks you to pick" in a
seaprate paragraph, which feels a bit detached than the original
here [***]).

> -By default, Git uses the same style as the one used by the "merge" program
> -from the RCS suite to present such a conflicted hunk, like this:
> -
> -------------
> -Here are lines that are either unchanged from the common
> -ancestor, or cleanly resolved because only one side changed,
> -or cleanly resolved because both sides changed the same way.
> -<<<<<<< yours:sample.txt
> -Conflict resolution is hard;
> -let's go shopping.
> -=======
> -Git makes conflict resolution easy.
> ->>>>>>> theirs:sample.txt
> -And here is another line that is cleanly resolved or unmodified.
> -------------
> -
> -The area where a pair of conflicting changes happened is marked with markers
> -+<<<<<<<+, `=======`, and +>>>>>>>+.  The part before the `=======`
> -is typically your side, and the part afterwards is typically their side.
> -
> -The default format does not show what the original said in the conflicting
> -area.  You cannot tell how many lines are deleted and replaced with
> -Barbie's remark on your side.  The only thing you can tell is that your
> -side wants to say it is hard and you'd prefer to go shopping, while the
> -other side wants to claim it is easy.

We covered all of the above, except for the reference to RCS which
we explicitly wanted to lose.  Good.

> -An alternative style can be used by setting the `merge.conflictStyle`
> ...
> -In addition to the +<<<<<<<+, `=======`, and +>>>>>>>+ markers, it uses
> -another +|||||||+ marker that is followed by the original text.

This is what we were missing in the new guide, which I tried to
rectify without looking at this exact text.  In any shape it should
be preserved somehow [***].

> - You can
> -tell that the original just stated a fact, and your side simply gave in to
> -that statement and gave up, while the other side tried to have a more
> -positive attitude.  You can sometimes come up with a better resolution by
> -viewing the original.

We covered this with "fruits from both sides" example, and I think
the explanation there is shorter and simpler to understand.

> -HOW TO RESOLVE CONFLICTS
> -------------------------
> -
> -After seeing a conflict, you can do two things:
> -
> - * Decide not to merge.  The only clean-ups you need are to reset
> -   the index file to the `HEAD` commit to reverse 2. and to clean
> -   up working tree changes made by 2. and 3.; `git merge --abort`
> -   can be used for this.
> -
> - * Resolve the conflicts.  Git will mark the conflicts in
> -   the working tree.  Edit the files into shape and
> -   `git add` them to the index.  Use `git commit` or
> -   `git merge --continue` to seal the deal. The latter command
> -   checks whether there is a (interrupted) merge in progress
> -   before calling `git commit`.

The new text tried to have a wiggle room with "most common", but
nothing is lost from the above if we tweak it with my suggested
"there are only two" [***].

> -You can work through the conflict with a number of tools:
> -
> - * Use a mergetool.  `git mergetool` to launch a graphical
> -   mergetool which will work through the merge with you.
> -
> - * Look at the diffs.  `git diff` will show a three-way diff,
> -   highlighting changes from both the `HEAD` and `MERGE_HEAD`
> -   versions. `git diff AUTO_MERGE` will show what changes you've
> -   made so far to resolve textual conflicts.
> -
> - * Look at the diffs from each branch. `git log --merge -p <path>`
> -   will show diffs first for the `HEAD` version and then the
> -   `MERGE_HEAD` version.
> -
> - * Look at the originals.  `git show :1:filename` shows the
> -   common ancestor, `git show :2:filename` shows the `HEAD`
> -   version, and `git show :3:filename` shows the `MERGE_HEAD`
> -   version.

We covered this in "Tools for handling" section.  This version
groups AUTO_MERGE together with other tools, which may have its
advantages and disadvantages.  The latter two bullet points in the
above list is about static view, so is three-way O A B diff.  Use of
mergetool and 'diff AUTO_MERGE" are more dynamic "how far have you
come" view.  So separating the "git diff" that shows three-way
comparison and "git diff AUTO_MERGE" in the new document sounds like
an improvement (even though 'mergetool' blurs the boundary between
"how the conflict looked like" and "what your eventual conflict you
are working toward may look like", though [***]).

Overall, I fully agree with these removals.  We may want to take a
few points (marked with [***]) we learned during this review back to
the new document from here, though.

Thanks.
Re: [PATCH v2 3/6] doc: git-rebase: link to new merge conflicts guide
#201
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:22
20 lines
10491 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> Remove some of the detail about how to handle a merge conflict, since
> it's explained in detail in the new guide, and there probably isn't
> enough detail anyway.
>
> Leave the steps since rebase is special and has a `--skip` option which
> the other commands which cause merge conflicts don't have.
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/git-rebase.adoc | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)

Great.  There is nothing I would miss from these removed lines.  All
are already described better in the new document, with or without
suggestions I made during reviews of [1/6] and [2/6].
Re: [PATCH v2 4/6] doc: git-revert: link to new merge conflicts guide
#202
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:24
40 lines
11025 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/git-revert.adoc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/git-revert.adoc b/Documentation/git-revert.adoc
> index ffba365e63..1edf98b9aa 100644
> --- a/Documentation/git-revert.adoc
> +++ b/Documentation/git-revert.adoc
> @@ -31,6 +31,10 @@ both will discard uncommitted changes in your working directory.
>  See "Reset, restore and revert" in linkgit:git[1] for the differences
>  between the three commands.
>  
> +If there have been new commits since the reverted commit, there may
> +be a merge conflict. See linkgit:gitmergeconflicts[7]
> +(or `git help mergeconflicts`) for a guide to handling merge conflicts.
> +

This is a strange thing to say.  Is it worth special casing the
revert of the tip commit that much?  "Reverting a commit may resolt
in a merge conflict" should be sufficient, I would think.



>  OPTIONS
>  -------
>  <commit>...::
> @@ -162,6 +166,7 @@ include::config/revert.adoc[]
>  SEE ALSO
>  --------
>  linkgit:git-cherry-pick[1]
> +linkgit:gitmergeconflicts[7]
>  
>  GIT
>  ---
Re: [PATCH v2 5/6] doc: git-cherry-pick: link to new merge conflicts guide
#204
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:26
36 lines
10876 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> -When it is not obvious how to apply a change, the following
> -happens:
> +When it is not obvious how to apply a change, there may
> +be a merge conflict. See linkgit:gitmergeconflicts[7]
> +(or `git help mergeconflicts`) for a guide to handling merge conflicts.

"Obvious to whom" was the first thing that came to my mind, even
though the blame largely lies on the original.  Can't we get rid of
the above pragraph altogether, and "See new one" at the end where
you replaced "See git-merge" reference below?

> +When a merge conflict happens:
>  
>  1. The current branch and `HEAD` pointer stay at the last commit
>     successfully made.
> @@ -36,9 +39,6 @@ happens:
>     conflict markers `<<<<<<<` and `>>>>>>>`.
>  5. No other modifications are made.
>  
> -See linkgit:git-merge[1] for some hints on resolving such
> -conflicts.
> -
>  OPTIONS
>  -------
>  <commit>...::
> @@ -259,6 +259,7 @@ $ git cherry-pick -Xpatience topic^  <4>
>  SEE ALSO
>  --------
>  linkgit:git-revert[1]
> +linkgit:gitmergeconflicts[7]
>  
>  GIT
>  ---
Re: [PATCH v2 6/6] doc: git-pull: link to new merge conflicts guide
#208
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:27
26 lines
10617 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Julia Evans <julia@jvns.ca>
>
> Signed-off-by: Julia Evans <julia@jvns.ca>
> ---
>  Documentation/git-pull.adoc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-pull.adoc b/Documentation/git-pull.adoc
> index 88f4fd3926..73f6d460bb 100644
> --- a/Documentation/git-pull.adoc
> +++ b/Documentation/git-pull.adoc
> @@ -38,7 +38,8 @@ or `pull.ff` with your preferred behaviour.
>  
>  If there's a merge conflict during the merge or rebase that you don't
>  want to handle, you can safely abort it with `git merge --abort` or
> -`git rebase --abort`.
> +`git rebase --abort`. See linkgit:gitmergeconflicts[7]
> +(or `git help mergeconflicts`) for a guide to handling merge conflicts.
>  
>  OPTIONS
>  -------

Very good.
Re: [PATCH v2 0/6] [doc] Add new page on merge conflicts
#206
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 18:36
19 lines
10342 bytes
"Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Julia Evans (6):
>   doc: add new gitmergeconflicts man page
>   doc: git-merge: link to new merge conflicts guide
>   doc: git-rebase: link to new merge conflicts guide
>   doc: git-revert: link to new merge conflicts guide
>   doc: git-cherry-pick: link to new merge conflicts guide
>   doc: git-pull: link to new merge conflicts guide

I've sent detailed reviews on #1 and commented on others.

You add my Reviewed-by: on [2/6], [3/6], and [6/6] if your new
iteration uses them as-is.  My suggestions to [4/6] and [5/6] are
both straight-forward, so if you choose to take them literally,
you can add my Reviewed-by: on them, too.

Thanks.
Re: [PATCH v2 1/6] doc: add new gitmergeconflicts man page
#236
Author: Junio C Hamano
Date: Fri, 09 Oct 2026 21:54
155 lines
16673 bytes
"Julia Evans" <julia@jvns.ca> writes:

>>> +* Resolve the conflict. (see <<resolve,HOW TO RESOLVE A MERGE CONFLICT>>
>>> +  below for details)
>>> +* Or stop the operation and return your branch to its original state
>>> +  with the appropriate `--abort` command, for example `git merge --abort`
>>> +  or `git rebase --abort`. See <<git_status,EXAMPLE: GIT STATUS OUTPUT>> below
>>> +  for how to find the command to run.
>>
>> Both are good options and I do not think of a middle way.  Perhaps
>> we do not have to say that these are "the most common" and instead
>> say "You handle a merge conflict by doing either of these two"?
>
> I agree the "the most common" is kind of weaselly and I'd like to be more clear.
> The reason I wrote "typically" is that during a rebase, there's an extra
> "skip" option, so it's not strictly true to say that there are just two options.
> Not sure if there's another option I'm not thinking of other than the
> "skip" in rebase.

I do not think anything like "rebase --skip" in a multi-step
integration is what this document covers particularly well to begin
with.  Taking each conflicted step individually, with "skip", you
are stopping the operation without resolving the conflict.

Perhaps make it clear that in the above you are talking about what
to do with each individual opportunity to give back conflict
resolution to the command?  If you describe these two choices in the
context of multi-step operation, each "we stopped due to conflict
and gave control back to you" opportunity gives you these choices:

 * Give up, pretend this step did not exist, and continue.
 * Resolve the conflict, record it, and continue.

In addition, you have "--abort" to give up the whole thing.
And a single step operation like "git merge" is a degenerated case
of the above.  "and continue" part does not exist.

> I was thinking about that too. Maybe we can briefly mention that git's
> merges are not guaranteed to produce working code even when they
> succeed and point to an example further down the page.
> Added to my list of things to work on.

It's not limited to "GIt's merges" but applies in general.

>>> +[[tools]]
>>> +TOOLS FOR HANDLING MERGE CONFLICTS
>>> +----------------------------------
>>> +
>>> +Here are some ways to get extra context while handling a merge conflict:
>>> +
>>> +* There are many graphical "merge tools" for Git, which will normally
>>> +  show you the different versions of the code side by side.
>>> +  If you have a mergetool configured, `git mergetool` will launch it.
>>> +  See also `merge.tool` in linkgit:git-config[1] for a list of
>>> +  the mergetools Git supports.
>>> +
>>> +* You can set the configuration option `merge.conflictstyle=diff3`.
>>> +  See <<diff3,DIFF3 AND ZDIFF3>> below for more.
>>
>> These are called 'configuration variables' throughout the manual
>> pages.  Be consistent and replace "configuration option" with
>> "configuration variable", perhaps?
>
> They seem to be both used interchangeably already:
>
> ```
> $ grep 'configuration variable' *.adoc | wc -l
>      256
> $ grep 'configuration option' *.adoc | wc -l
>       46
> ```

Do not make it worse.  The latter were mostly added people like you
who responds like the above; aim to be more consistent instead.

>>> +* `git log --merge -p <filename>`  will list all commits which
>>> +  caused the merge conflict for `<filename>`, and the diff
>>> +  of how they changed the file.
>>
>> Maybe worth mentioning that `--left-right` often helps when you are
>> not super familiar with the histories being merged.
>
> I don't understand what this does or what it would be useful for so
> it's not possible for me to explain it  :). From my perspective
> "ours" and "theirs" are already confusing enough and introducing
> "left" and "right" seems like a lot. Is "left" the same as "ours"?

If you do not understand what it does, perhaps try it out?

"git log -p --merge" is to break down the ours/theirs into
individual steps when changes on these sides were brought in in
multiple steps.  It shows individual changes per commit, but if you
are not super familiar with these histories being merged, it is not
obvious which commit came from which side.  And --left-right option
is a way to help you tell which one came from which.

>>> +* Use `git diff AUTO_MERGE` to show what changes you've made so far to
>>> +  resolve the conflicts.
>>
>> Does a "See below" here help readers who haven't learned what
>> AUTO_MERGE is?  If you can describe what AUTO_MERGE records (in
>> other words, what you are comparing your progress against) in a
>> sentence of two here, that would alleviate the need to assure them
>> that we have more in-depth coverage on this topic elsewhere.
>
> I think this is okay the way it is.

Is it because, unlike --left-right, you understand what it does?
Not everybody shares what you know, you know ;-)

 * AUTO_MERGE records the initial merge result with conflict
   markers.  `git diff AUTO_MERGE` can be used to show how much
   progress you made to resolve these conflicts.

perhaps.

> Maybe we could add a note like this somewhere?
>
>    NOTE: zdiff3 was an experimental alternative to diff3 that makes
>    the merge conflict shorter by introducing more ambiguity.
>    It's still there for backwards compatibility but we don't recommend it.

Drop "experimental" and I am 100% behind that statement ;-).

>> By the way, is it just me who finds those "Here's", "there's"
>> contractions disturbing in an official manual?  I've seen many of
>> them while reviewing this to be annoyed enough and had to blurt it
>> out X-<.
>
> I find "here is" and "there is" to be distracting and overly formal,
> different people are different I guess :)

I would prefer to be consistent in a single documentation set, though.

>> The text comes from ffb1a4bed5 (Documentation: Describe merge
>> operation a bit better., 2005-11-28) that had "When there are
>> conflicts, these things happen. 1. HEAD does not move, 2. Cleanly
>> merged paths are updated in the index 3. Conflicts are recorded in
>> higher stage index entries and working tree files show conflict
>> markers, 4. No other changes are done" well before the mysterious
>> reference to 2. and 3.
>>
>> When ebef7e5049 (Documentation: simplify How Merge Works,
>> 2010-01-23) tried to simplify the description, the list of "these
>> things happen" were removed/rewritten, and yet instructions on how
>> to reset are left behind, still referring to 2. and 3.
>>
>> We probably want a separate patch for Documentation/git-merge.adoc
>> to rectify this 16 year old mistake.
>
> Thanks for investigating!

Heh, you already did the separate patch, which is [2/6], which I am
happy with.
Re: [PATCH v2 0/6] [doc] Add new page on merge conflicts
#235
Author: Ben Knoble
Date: Fri, 09 Oct 2026 22:10
28 lines
9051 bytes
> Le 9 oct. 2026 à 11:41, Junio C Hamano <gitster@pobox.com> a écrit :
> 
> > "Julia Evans via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
> For example, you added Ben and Patrick to the trailer of patch #1.
> 
>> Range-diff vs v1:
>> 
>> 1:  ad4853dc36 ! 1:  ab0344f947 [doc] Add new gitmergeconflicts man page
>>     @@ Metadata
>>      Author: Julia Evans <julia@jvns.ca>
>> 
>>       ## Commit message ##
>>     -    [doc] Add new gitmergeconflicts man page
>>     +    doc: add new gitmergeconflicts man page
>> ...
>>          Co-Authored-By: Marie Claire LeBlanc Flanagan <hello@marieflanagan.com>
>>     +    Reviewed-by: D. Ben Knoble <ben.knoble+github@gmail.com>
>>     +    Reviewed-by: Patrick Steinhardt <ps@pks.im>
>>          Signed-off-by: Julia Evans <julia@jvns.ca>

PS I think I just use my non-suffixed email on this project; 
see our .mailmap :)
Re: [PATCH v2 1/6] doc: add new gitmergeconflicts man page
#242
Author: Junio C Hamano
Date: Sat, 10 Oct 2026 01:45
39 lines
11338 bytes
"Julia Evans" <julia@jvns.ca> writes:

Comments on a few more points.

>> Is it deliberate to omit 'am -3' and 'checkout -m', perhaps in order
>> to limit ourselves to most common ways to help new people by keeping
>> the description to the absolute minimum?
>
> It's deliberate, we talked about that a bit in the discussion of the v1.
> Can add a note in the commit message.

Being a part of _the_ technical manual on Git, I would like to see
us aim for completeness, and where we don't leave a note that the
description is not complete.  In this case,  between

    Merge conflicts can happen during a `git merge`, `git rebase`, `git
    cherry-pick`, `git pull`, `git am -3`, `git checkout -m`, `git
    stash pop`, or `git revert`.

that aims for completeness and

    Merge conflicts can happen during a `git merge`, `git rebase`, `git
    cherry-pick`, `git pull`, or `git revert`, and other operations.

that admits the list is not complete, I have slight preference to
the first one.

>> By the way, is it just me who finds those "Here's", "there's"
>> contractions disturbing in an official manual?  I've seen many of
>> them while reviewing this to be annoyed enough and had to blurt it
>> out X-<.
>
> I find "here is" and "there is" to be distracting and overly formal,
> different people are different I guess :)

But I wouldn't want you to be "different" here.  This is not your
diary or personal note.  This being a part of the technical manual,
I would prefer to see the same formalness applied everywhere.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads