{"thread":{"id":"59598","subject":"[PATCH 0/5] Document 'AUTO_MERGE' and more special refs","startedAt":"2023-04-14T17:58:45Z","lastAt":"2023-06-01T07:32:11Z","messageCount":35,"participants":["Philippe Blain via GitGitGadget","Junio C Hamano","Victoria Dye","Taylor Blau","Eric Sunshine","Felipe Contreras","Elijah Newren","Philippe Blain","Chris Torek"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"475397","messageId":"pull.1515.git.1681495119.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":null,"subject":"[PATCH 0/5] Document 'AUTO_MERGE' and more special refs","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:33Z","receivedAt":"2023-04-14T17:58:45Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"This series adds documentation (and completion!) for AUTO_MERGE. In doing so\nI noticed that some other special refs where not mentioned in 'gitrevisions'\nnor suggested by the completion, so I also tried to improve that.\n\nSince the changes are in the same parts of the same files, I thought it made\nmore sense to send everything in the same series to avoid conflicts, but I\ncan send the AUTO_MERGE patches on top of the other ones in a separate\nseries if that would be preferred.\n\nHere is a breakdown of the patches. First the \"other special refs\" patches:\n\n * [PATCH 1/5] revisions.txt: document more special refs\n * [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD\n\nThen a preparatory cleanup for the AUTO_MERGE patches:\n\n * [PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section\n\nFinally the AUTO_MERGE patches:\n\n * [PATCH 4/5] Documentation: document AUTO_MERGE\n * [PATCH 5/5] completion: complete AUTO_MERGE\n\nThanks Elijah for this very useful feature! Dscho, I'm CC-ing you since you\nopened https://github.com/gitgitgadget/git/issues/1471, I hope that's OK.\n\nCheers,\n\nPhilippe.\n\nPhilippe Blain (5):\n  revisions.txt: document more special refs\n  completion: complete REVERT_HEAD and BISECT_HEAD\n  git-merge.txt: modernize word choice in \"True merge\" section\n  Documentation: document AUTO_MERGE\n  completion: complete AUTO_MERGE\n\n Documentation/git-diff.txt             |  8 +++++++-\n Documentation/git-merge.txt            | 11 ++++++++---\n Documentation/revisions.txt            | 15 ++++++++++++--\n Documentation/user-manual.txt          | 27 ++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |  2 +-\n 5 files changed, 56 insertions(+), 7 deletions(-)\n\n\nbase-commit: a0f05f684010332ab3a706979d191b9157643f80\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1515%2Fphil-blain%2Fdoc-auto-merge-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1515/phil-blain/doc-auto-merge-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/1515\n-- \ngitgitgadget\n"},{"id":"475398","messageId":"66c7e514157f3c8220eb994cea7c4659d5241042.1681495119.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH 1/5] revisions.txt: document more special refs","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:34Z","receivedAt":"2023-04-14T17:58:47Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nSome special refs, namely HEAD, FETCH_HEAD, ORIG_HEAD, MERGE_HEAD and\nCHERRY_PICK_HEAD, are mentioned and described in 'gitrevisions', but some\nothers, namely REBASE_HEAD, REVERT_HEAD, and BISECT_HEAD, are not.\n\nAdd a small description of these special refs.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/revisions.txt | 11 +++++++++--\n 1 file changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex 9aa58052bc7..98b8f89bc8d 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -32,8 +32,8 @@ characters and to avoid word splitting.\n   first match in the following rules:\n \n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n-    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n-    and `CHERRY_PICK_HEAD`);\n+    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n+    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n \n   . otherwise, 'refs/<refname>' if it exists;\n \n@@ -55,8 +55,15 @@ you can easily change the tip of the branch back to the state before you ran\n them.\n `MERGE_HEAD` records the commit(s) which you are merging into your branch\n when you run `git merge`.\n+`REBASE_HEAD`, during a rebase, records the commit at which the\n+operation is currently stopped, either because of conflicts or an `edit`\n+command in an interactive rebase.\n+`REVERT_HEAD` records the commit which you are reverting when you\n+run `git revert`.\n `CHERRY_PICK_HEAD` records the commit which you are cherry-picking\n when you run `git cherry-pick`.\n+`BISECT_HEAD` records the current commit to be tested when you\n+run `git bisect --no-checkout`.\n +\n Note that any of the 'refs/*' cases above may come either from\n the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n-- \ngitgitgadget\n\n"},{"id":"475399","messageId":"62b68829c5aeaa28a79192b55058e87a0ef72816.1681495119.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:36Z","receivedAt":"2023-04-14T17:58:49Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe \"True merge\" section of the 'git merge' documentation mentions that\nin case of conflicts, the conflicted working tree files contain \"the\nresult of the \"merge\" program\". This probably refers to RCS' 'merge'\nprogram, which is mentioned further down under \"How conflicts are\npresented\".\n\nSince it is not clear at that point of the document which program is\nreferred to, and since most modern readers probably do not relate to RCS\nanyway, let's just write \"the merge operation\" instead.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/git-merge.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\nindex 0aeff572a59..23aefe28851 100644\n--- a/Documentation/git-merge.txt\n+++ b/Documentation/git-merge.txt\n@@ -194,7 +194,7 @@ happens:\n    versions: stage 1 stores the version from the common ancestor,\n    stage 2 from `HEAD`, and stage 3 from `MERGE_HEAD` (you\n    can inspect the stages with `git ls-files -u`).  The working\n-   tree files contain the result of the \"merge\" program; i.e. 3-way\n+   tree files contain the result of the merge operation; i.e. 3-way\n    merge results with familiar conflict markers `<<<` `===` `>>>`.\n 5. No other changes are made.  In particular, the local\n    modifications you had before you started merge will stay the\n-- \ngitgitgadget\n\n"},{"id":"475400","messageId":"f3a47758f9dce20c29ffb776bffaf73e238c20d1.1681495119.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:35Z","receivedAt":"2023-04-14T17:58:51Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe pseudorefs REVERT_HEAD and BISECT_HEAD are not suggested\nby the __git_refs function. Add them there.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex dc95c34cc85..bcda376735c 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -767,7 +767,7 @@ __git_refs ()\n \t\t\ttrack=\"\"\n \t\t\t;;\n \t\t*)\n-\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do\n+\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do\n \t\t\t\tcase \"$i\" in\n \t\t\t\t$match*|$umatch*)\n \t\t\t\t\tif [ -e \"$dir/$i\" ]; then\n-- \ngitgitgadget\n\n"},{"id":"475401","messageId":"88cc7a80f313b5511e62d4df064887cc709f76ca.1681495119.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH 5/5] completion: complete AUTO_MERGE","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:38Z","receivedAt":"2023-04-14T17:58:59Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe pseudoref AUTO_MERGE is documented since the previous commit. To\nmake it easier to use, let __git_refs in the Bash completion code\ncomplete it.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex bcda376735c..945d2543b07 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -767,7 +767,7 @@ __git_refs ()\n \t\t\ttrack=\"\"\n \t\t\t;;\n \t\t*)\n-\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do\n+\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD AUTO_MERGE; do\n \t\t\t\tcase \"$i\" in\n \t\t\t\t$match*|$umatch*)\n \t\t\t\t\tif [ -e \"$dir/$i\" ]; then\n-- \ngitgitgadget\n"},{"id":"475402","messageId":"0cdd4ab3d739e07357ea9efef2cdece633db6ebb.1681495119.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-04-14T17:58:37Z","receivedAt":"2023-04-14T17:59:00Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nSince 5291828df8 (merge-ort: write $GIT_DIR/AUTO_MERGE whenever we hit a\nconflict, 2021-03-20), when using the 'ort' merge strategy, the special\nref AUTO_MERGE is written when a merge operation results in conflicts.\nThis ref points to a tree recording the conflicted state of the working\ntree and is very useful during conflict resolution. However, this ref is\nnot documented.\n\nAdd some documentation for AUTO_MERGE in git-diff(1), git-merge(1),\ngitrevisions(7) and in the user manual.\n\nIn git-diff(1), mention it at the end of the description section, when\nwe mention that the command also accepts trees instead of commits, and\nalso add an invocation to the \"Various ways to check your working tree\"\nexample.\n\nIn git-merge(1), add a step to the list of things that happen \"when it\nis not obvious how to reconcile the changes\", under the \"True merge\"\nsecion. Also mention AUTO_MERGE in the \"How to resolve conflicts\"\nsection, when mentioning 'git diff'.\n\nIn gitrevisions(7), add a mention of AUTO_MERGE along with the other\nspecial refs.\n\nIn the user manual, add a paragraph describing AUTO_MERGE to the\n\"Getting conflict-resolution help during a merge\" section, and include\nan example of a 'git diff AUTO_MERGE' invocation for the example\nconflict used in that section. Note that for uniformity we do not use\nbackticks around AUTO_MERGE here since the rest of the document does not\ntypeset special refs differently.\n\nCloses: https://github.com/gitgitgadget/git/issues/1471\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/git-diff.txt    |  8 +++++++-\n Documentation/git-merge.txt   |  9 +++++++--\n Documentation/revisions.txt   |  6 +++++-\n Documentation/user-manual.txt | 27 +++++++++++++++++++++++++++\n 4 files changed, 46 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 52b679256c4..a85cc756ebc 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -102,7 +102,11 @@ If --merge-base is given, use the merge base of the two commits for the\n Just in case you are doing something exotic, it should be\n noted that all of the <commit> in the above description, except\n in the `--merge-base` case and in the last two forms that use `..`\n-notations, can be any <tree>.\n+notations, can be any <tree>. A tree of interest is the one pointed to\n+by the special ref `AUTO_MERGE`, which is written by the 'ort' merge\n+strategy upon hitting merge conflicts (see linkgit:git-merge[1]).\n+Comparing the working tree with `AUTO_MERGE` shows changes you've made\n+so far to resolve conflicts (see the examples below).\n \n For a more complete list of ways to spell <commit>, see\n \"SPECIFYING REVISIONS\" section in linkgit:gitrevisions[7].\n@@ -152,6 +156,7 @@ Various ways to check your working tree::\n $ git diff            <1>\n $ git diff --cached   <2>\n $ git diff HEAD       <3>\n+$ git diff AUTO_MERGE <4>\n ------------\n +\n <1> Changes in the working tree not yet staged for the next commit.\n@@ -159,6 +164,7 @@ $ git diff HEAD       <3>\n     would be committing if you run `git commit` without `-a` option.\n <3> Changes in the working tree since your last commit; what you\n     would be committing if you run `git commit -a`\n+<4> Changes in the working tree you've made to resolve conflicts so far.\n \n Comparing with arbitrary commits::\n +\ndiff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\nindex 23aefe28851..3f61389c1c2 100644\n--- a/Documentation/git-merge.txt\n+++ b/Documentation/git-merge.txt\n@@ -196,7 +196,11 @@ happens:\n    can inspect the stages with `git ls-files -u`).  The working\n    tree files contain the result of the merge operation; i.e. 3-way\n    merge results with familiar conflict markers `<<<` `===` `>>>`.\n-5. No other changes are made.  In particular, the local\n+5. A special ref `AUTO_MERGE` is written, pointing to a tree corresponding\n+   to the current content of the working tree (including conflict markers).\n+   Note that this ref is only written when the 'ort' merge strategy\n+   is used (the default).\n+6. No other changes are made.  In particular, the local\n    modifications you had before you started merge will stay the\n    same and the index entries for them stay as they were,\n    i.e. matching `HEAD`.\n@@ -336,7 +340,8 @@ You can work through the conflict with a number of tools:\n \n  * Look at the diffs.  `git diff` will show a three-way diff,\n    highlighting changes from both the `HEAD` and `MERGE_HEAD`\n-   versions.\n+   versions. `git diff AUTO_MERGE` will show what changes you've\n+   made so far to resolve conlicts.\n \n  * Look at the diffs from each branch. `git log --merge -p <path>`\n    will show diffs first for the `HEAD` version and then the\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex 98b8f89bc8d..b42a2bb30a5 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -33,7 +33,8 @@ characters and to avoid word splitting.\n \n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n     useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n-    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n+    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD`, `BISECT_HEAD`\n+    and `AUTO_MERGE`);\n \n   . otherwise, 'refs/<refname>' if it exists;\n \n@@ -64,6 +65,9 @@ run `git revert`.\n when you run `git cherry-pick`.\n `BISECT_HEAD` records the current commit to be tested when you\n run `git bisect --no-checkout`.\n+`AUTO_MERGE` records a tree object corresponding to the state the\n+'ort' merge strategy wrote to the working tree when a merge operation\n+resulted in conflicts.\n +\n Note that any of the 'refs/*' cases above may come either from\n the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\ndiff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\nindex dc9c6a663a9..99e5f652e92 100644\n--- a/Documentation/user-manual.txt\n+++ b/Documentation/user-manual.txt\n@@ -1343,6 +1343,33 @@ $ git diff -3 file.txt\t\t# diff against stage 3\n $ git diff --theirs file.txt\t# same as the above.\n -------------------------------------------------\n \n+When using the 'ort' merge strategy (the default), before updating the working\n+tree with the result of the merge, Git writes a special ref named AUTO_MERGE\n+reflecting the state of the tree it is about to write. Conflicted paths that\n+could not be automatically merged are written to this tree with conflict\n+markers, just as in the working tree. AUTO_MERGE can thus be used with\n+linkgit:git-diff[1] to show the changes you've made so far to resolve\n+conflicts. Using the same example as above, after resolving the conflict we\n+get:\n+\n+-------------------------------------------------\n+$ git diff AUTO_MERGE\n+diff --git a/file.txt b/file.txt\n+index cd10406..8bf5ae7 100644\n+--- a/file.txt\n++++ b/file.txt\n+@@ -1,5 +1 @@\n+-<<<<<<< HEAD:file.txt\n+-Hello world\n+-=======\n+-Goodbye\n+->>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n++Goodbye world\n+-------------------------------------------------\n+\n+Notice that the diff shows we deleted the conflict markers and both versions,\n+and wrote \"Goodbye world\" instead.\n+\n The linkgit:git-log[1] and linkgit:gitk[1] commands also provide special help\n for merges:\n \n-- \ngitgitgadget\n\n"},{"id":"475404","messageId":"xmqqpm86qpnk.fsf@gitster.g","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/5] Document 'AUTO_MERGE' and more special refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-14T18:34:07Z","receivedAt":"2023-04-14T18:34:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> This series adds documentation (and completion!) for AUTO_MERGE.\n\nNice.  It indeed is one of the hard-to-discover gems.\n"},{"id":"475406","messageId":"xmqq8reuqoyk.fsf@gitster.g","threadId":"59598","inReplyTo":"66c7e514157f3c8220eb994cea7c4659d5241042.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/5] revisions.txt: document more special refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-14T18:49:07Z","receivedAt":"2023-04-14T18:49:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> Some special refs, namely HEAD, FETCH_HEAD, ORIG_HEAD, MERGE_HEAD and\n> CHERRY_PICK_HEAD, are mentioned and described in 'gitrevisions', but some\n> others, namely REBASE_HEAD, REVERT_HEAD, and BISECT_HEAD, are not.\n>\n> Add a small description of these special refs.\n>\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n>  Documentation/revisions.txt | 11 +++++++++--\n>  1 file changed, 9 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\n> index 9aa58052bc7..98b8f89bc8d 100644\n> --- a/Documentation/revisions.txt\n> +++ b/Documentation/revisions.txt\n> @@ -32,8 +32,8 @@ characters and to avoid word splitting.\n>    first match in the following rules:\n>  \n>    . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n> -    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n> -    and `CHERRY_PICK_HEAD`);\n> +    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n> +    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n\nAdding missing ones and enumerating them indeed is good, but I\nwonder if the readers will be helped if they are exposed to the\nphrase \"pseudoref\" here.\n\n\tThis is usually useful only for the pseudorefs, i.e. `HEAD`,\n\t`FETCH_HEAD`, ...\"\n\nWe have definition of it in the glossary, but it does not have an\nexhaustive list (and if we want to have an exhausitive list on this\npage, the glossary definition of pseudoref may want to point at this\npage).\n\nIt is an unrelated tangent that shouldn't be added to the\ndocumentation (yet), but didn't we have a plan to limit the\npseudorefs to those names that end with \"_HEAD\"?\n\n> +`REBASE_HEAD`, during a rebase, records the commit at which the\n> +operation is currently stopped, either because of conflicts or an `edit`\n> +command in an interactive rebase.\n\nOK.\n\n> +`REVERT_HEAD` records the commit which you are reverting when you\n> +run `git revert`.\n\nOK.\n\n\n> +`BISECT_HEAD` records the current commit to be tested when you\n> +run `git bisect --no-checkout`.\n\nOK.\n\nLooking very good.\n"},{"id":"475411","messageId":"ebcf2426-db40-e967-9db5-532869cac8ff@github.com","threadId":"59598","inReplyTo":"66c7e514157f3c8220eb994cea7c4659d5241042.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 1/5] revisions.txt: document more special refs","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2023-04-14T19:49:16Z","receivedAt":"2023-04-14T19:49:31Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Philippe Blain via GitGitGadget wrote:\n> @@ -55,8 +55,15 @@ you can easily change the tip of the branch back to the state before you ran\n>  them.\n>  `MERGE_HEAD` records the commit(s) which you are merging into your branch\n>  when you run `git merge`.\n> +`REBASE_HEAD`, during a rebase, records the commit at which the\n> +operation is currently stopped, either because of conflicts or an `edit`\n> +command in an interactive rebase.\n> +`REVERT_HEAD` records the commit which you are reverting when you\n> +run `git revert`.\n>  `CHERRY_PICK_HEAD` records the commit which you are cherry-picking\n>  when you run `git cherry-pick`.\n> +`BISECT_HEAD` records the current commit to be tested when you\n> +run `git bisect --no-checkout`.\n\nThis is a fairly minor point, so feel free to ignore if you disagree or feel\nit's not worth the effort:\n\nAlthough the special refs in this list (HEAD, MERGE_HEAD, REBASE_HEAD etc.)\nare visually separated by newlines in this doc, they render in the manpages\n& HTML in a single monolithic paragraph (see [1]). With the addition of\nthree more descriptions (four if you count 'AUTO_MERGE' in patch 4/5), that\nparagraph is getting large enough that it might be difficult for a reader to\nparse and find information about a specific ref. \n\nTo help with that, you could create visual separation in the rendered doc by\nadding a '+' between each special ref description; converting them into a\nbullet pointed list would also work, I think.\n\n[1] https://git-scm.com/docs/revisions#Documentation/revisions.txt-emltrefnamegtemegemmasterememheadsmasterememrefsheadsmasterem\n\n>  +\n>  Note that any of the 'refs/*' cases above may come either from\n>  the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n\n"},{"id":"475412","messageId":"90d1402c-b0b0-4b7e-0c6e-930774b02dfe@github.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/5] Document 'AUTO_MERGE' and more special refs","fromName":"Victoria Dye","fromEmail":"vdye@github.com","sentAt":"2023-04-14T19:49:52Z","receivedAt":"2023-04-14T19:49:57Z","isPatch":true,"sender":{"key":"vdye@github.com","avatar":"https://avatars.githubusercontent.com/u/3619353?v=4"},"body":"Philippe Blain via GitGitGadget wrote:\n> Here is a breakdown of the patches. First the \"other special refs\" patches:\n> \n>  * [PATCH 1/5] revisions.txt: document more special refs\n>  * [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD\n> \n> Then a preparatory cleanup for the AUTO_MERGE patches:\n> \n>  * [PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section\n> \n> Finally the AUTO_MERGE patches:\n> \n>  * [PATCH 4/5] Documentation: document AUTO_MERGE\n>  * [PATCH 5/5] completion: complete AUTO_MERGE\n> \n> Thanks Elijah for this very useful feature! Dscho, I'm CC-ing you since you\n> opened https://github.com/gitgitgadget/git/issues/1471, I hope that's OK.\n> \n> Cheers,\n> \n> Philippe.\n\nThe documentation you've added is clear without being too verbose (the\nAUTO_MERGE description & example in patch 4 are especially helpful), the\ncompletion changes are a nice quality-of-life improvement, and the patches\nare well-organized. Aside from one minor (and entirely optional) suggestion\nin patch 1, everything in this series looks great to me. Thank you for\nmaking these changes! \n\n"},{"id":"475413","messageId":"xmqq4jpiqki4.fsf@gitster.g","threadId":"59598","inReplyTo":"f3a47758f9dce20c29ffb776bffaf73e238c20d1.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-14T20:25:23Z","receivedAt":"2023-04-14T20:25:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> The pseudorefs REVERT_HEAD and BISECT_HEAD are not suggested\n> by the __git_refs function. Add them there.\n>\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n>  contrib/completion/git-completion.bash | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index dc95c34cc85..bcda376735c 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -767,7 +767,7 @@ __git_refs ()\n>  \t\t\ttrack=\"\"\n>  \t\t\t;;\n>  \t\t*)\n> -\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do\n> +\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do\n>  \t\t\t\tcase \"$i\" in\n>  \t\t\t\t$match*|$umatch*)\n>  \t\t\t\t\tif [ -e \"$dir/$i\" ]; then\n\nThis does obvious change to add two completion possibilities reusing\nexactly the same logic we have been using.\n\nA tangent related to my earlier \"didn't we plan to limit them to\n*_HEAD at some point?\" is that we could turn the loop around and do\nsomething like\n\n\t\tfor i in HEAD $(cd \"$dir\" && echo *_HEAD)\n\t\tdo\n\t\t\tcase \"$i\" in\n\t\t\t$match*|$umatch*)\n\t\t\t\tif test -f \"$dir/$i\"\n\t\t\t\tthen\n\t\t\t\t\t...\n\nwhich could be a lot more future-proof, once we have such a rule.\n\nBut that is a tangent that we should wait until the current series\nsettles.\n\nThanks.\n\n"},{"id":"475414","messageId":"xmqqr0smp5ft.fsf@gitster.g","threadId":"59598","inReplyTo":"62b68829c5aeaa28a79192b55058e87a0ef72816.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-14T20:36:06Z","receivedAt":"2023-04-14T20:36:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> The \"True merge\" section of the 'git merge' documentation mentions that\n> in case of conflicts, the conflicted working tree files contain \"the\n> result of the \"merge\" program\". This probably refers to RCS' 'merge'\n> program, which is mentioned further down under \"How conflicts are\n> presented\".\n>\n> Since it is not clear at that point of the document which program is\n> referred to, and since most modern readers probably do not relate to RCS\n> anyway, let's just write \"the merge operation\" instead.\n\nGood.\n\nI suspect that the original refers literally to the RCS's merge\nprogram.  Until caba139d (Use git-merge-file in git-merge-one-file,\ntoo, 2006-12-22) switched to use our poor-man's substitute for\n\"merge\", we used to invoke \"merge\" for three-way merge.\n\nWe no longer do, and a more generic \"merge operation\" is certainly a\nlot more appropriate in today's world.\n\n>     can inspect the stages with `git ls-files -u`).  The working\n> -   tree files contain the result of the \"merge\" program; i.e. 3-way\n> +   tree files contain the result of the merge operation; i.e. 3-way\n>     merge results with familiar conflict markers `<<<` `===` `>>>`.\n\n"},{"id":"475415","messageId":"ZDnCMegeiw0kT5oj@nand.local","threadId":"59598","inReplyTo":"ebcf2426-db40-e967-9db5-532869cac8ff@github.com","subject":"Re: [PATCH 1/5] revisions.txt: document more special refs","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-04-14T21:14:25Z","receivedAt":"2023-04-14T21:14:36Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Fri, Apr 14, 2023 at 12:49:16PM -0700, Victoria Dye wrote:\n> To help with that, you could create visual separation in the rendered doc by\n> adding a '+' between each special ref description; converting them into a\n> bullet pointed list would also work, I think.\n\nIn case you're looking for another option, you could convert these into\na description list, which would be consistent with the outer-most list\nin this document.\n\nI had to refresh myself on how the spacing and continuations work in\nASCIIdoc, but I think the following (which applies on top of this patch)\nis right:\n\n--- 8< ---\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex 98b8f89bc8..b34f981622 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -30,7 +30,7 @@ characters and to avoid word splitting.\n   explicitly say 'heads/master' to tell Git which one you mean.\n   When ambiguous, a '<refname>' is disambiguated by taking the\n   first match in the following rules:\n-\n++\n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n     useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n     `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n@@ -44,26 +44,34 @@ characters and to avoid word splitting.\n   . otherwise, 'refs/remotes/<refname>' if it exists;\n\n   . otherwise, 'refs/remotes/<refname>/HEAD' if it exists.\n+\n +\n-`HEAD` names the commit on which you based the changes in the working tree.\n-`FETCH_HEAD` records the branch which you fetched from a remote repository\n-with your last `git fetch` invocation.\n-`ORIG_HEAD` is created by commands that move your `HEAD` in a drastic\n-way (`git am`, `git merge`, `git rebase`, `git reset`),\n-to record the position of the `HEAD` before their operation, so that\n-you can easily change the tip of the branch back to the state before you ran\n-them.\n-`MERGE_HEAD` records the commit(s) which you are merging into your branch\n-when you run `git merge`.\n-`REBASE_HEAD`, during a rebase, records the commit at which the\n-operation is currently stopped, either because of conflicts or an `edit`\n-command in an interactive rebase.\n-`REVERT_HEAD` records the commit which you are reverting when you\n-run `git revert`.\n-`CHERRY_PICK_HEAD` records the commit which you are cherry-picking\n-when you run `git cherry-pick`.\n-`BISECT_HEAD` records the current commit to be tested when you\n-run `git bisect --no-checkout`.\n+  `HEAD`:::\n+    names the commit on which you based the changes in the working tree.\n+  `FETCH_HEAD`:::\n+    records the branch which you fetched from a remote repository with\n+    your last `git fetch` invocation.\n+  `ORIG_HEAD`:::\n+    is created by commands that move your `HEAD` in a drastic way (`git\n+    am`, `git merge`, `git rebase`, `git reset`), to record the position\n+    of the `HEAD` before their operation, so that you can easily change\n+    the tip of the branch back to the state before you ran them.\n+  `MERGE_HEAD`:::\n+    records the commit(s) which you are merging into your branch when you\n+    run `git merge`.\n+  `REBASE_HEAD`:::\n+    during a rebase, records the commit at which the operation is\n+    currently stopped, either because of conflicts or an `edit` command in\n+    an interactive rebase.\n+  `REVERT_HEAD`:::\n+    records the commit which you are reverting when you run `git revert`.\n+  `CHERRY_PICK_HEAD`:::\n+    records the commit which you are cherry-picking when you run `git\n+    cherry-pick`.\n+  `BISECT_HEAD`:::\n+    records the current commit to be tested when you run `git bisect\n+    --no-checkout`.\n+\n +\n Note that any of the 'refs/*' cases above may come either from\n the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n--- >8 ---\n\nThanks,\nTaylor\n"},{"id":"475425","messageId":"ZDnIiuFC0/LaP8K5@nand.local","threadId":"59598","inReplyTo":"0cdd4ab3d739e07357ea9efef2cdece633db6ebb.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2023-04-14T21:41:30Z","receivedAt":"2023-04-14T21:41:40Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Fri, Apr 14, 2023 at 05:58:37PM +0000, Philippe Blain via GitGitGadget wrote:\n> Closes: https://github.com/gitgitgadget/git/issues/1471\n\nNeat. This does close the corresponding issue once the result gets\npushed back to gitgitgadget/git. TIL!\n\n> ---\n>  Documentation/git-diff.txt    |  8 +++++++-\n>  Documentation/git-merge.txt   |  9 +++++++--\n>  Documentation/revisions.txt   |  6 +++++-\n>  Documentation/user-manual.txt | 27 +++++++++++++++++++++++++++\n>  4 files changed, 46 insertions(+), 4 deletions(-)\n\nThese changes all look great to me, well written and explained.\n\nThanks,\nTaylor\n"},{"id":"475431","messageId":"CAPig+cQQVby2g+_kfucbYdwOZW5_CEyyyOex=4hXoCJt7TkjeA@mail.gmail.com","threadId":"59598","inReplyTo":"0cdd4ab3d739e07357ea9efef2cdece633db6ebb.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2023-04-15T05:08:21Z","receivedAt":"2023-04-15T05:08:37Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, Apr 14, 2023 at 2:13 PM Philippe Blain via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> Add some documentation for AUTO_MERGE in git-diff(1), git-merge(1),\n> gitrevisions(7) and in the user manual.\n>\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\n> @@ -1343,6 +1343,33 @@ $ git diff -3 file.txt           # diff against stage 3\n> +-------------------------------------------------\n> +$ git diff AUTO_MERGE\n> +diff --git a/file.txt b/file.txt\n> +index cd10406..8bf5ae7 100644\n> +--- a/file.txt\n> ++++ b/file.txt\n> +@@ -1,5 +1 @@\n> +-<<<<<<< HEAD:file.txt\n> +-Hello world\n> +-=======\n> +-Goodbye\n> +->>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n> ++Goodbye world\n> +-------------------------------------------------\n> +\n> +Notice that the diff shows we deleted the conflict markers and both versions,\n> +and wrote \"Goodbye world\" instead.\n\nSome grammatical problem here. Perhaps s/and both/in both/, or maybe\njust drop \"and both versions\"?\n"},{"id":"475432","messageId":"643a33b5e6a3a_1466294b2@chronos.notmuch","threadId":"59598","inReplyTo":"xmqq8reuqoyk.fsf@gitster.g","subject":"Re: [PATCH 1/5] revisions.txt: document more special refs","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2023-04-15T05:18:45Z","receivedAt":"2023-04-15T05:18:53Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> \"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n> \n> > From: Philippe Blain <levraiphilippeblain@gmail.com>\n> >\n> > Some special refs, namely HEAD, FETCH_HEAD, ORIG_HEAD, MERGE_HEAD and\n> > CHERRY_PICK_HEAD, are mentioned and described in 'gitrevisions', but some\n> > others, namely REBASE_HEAD, REVERT_HEAD, and BISECT_HEAD, are not.\n> >\n> > Add a small description of these special refs.\n> >\n> > Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> > ---\n> >  Documentation/revisions.txt | 11 +++++++++--\n> >  1 file changed, 9 insertions(+), 2 deletions(-)\n> >\n> > diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\n> > index 9aa58052bc7..98b8f89bc8d 100644\n> > --- a/Documentation/revisions.txt\n> > +++ b/Documentation/revisions.txt\n> > @@ -32,8 +32,8 @@ characters and to avoid word splitting.\n> >    first match in the following rules:\n> >  \n> >    . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n> > -    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n> > -    and `CHERRY_PICK_HEAD`);\n> > +    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n> > +    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n> \n> Adding missing ones and enumerating them indeed is good, but I\n> wonder if the readers will be helped if they are exposed to the\n> phrase \"pseudoref\" here.\n\nFirst time I've heard that term.\n\n> \tThis is usually useful only for the pseudorefs, i.e. `HEAD`,\n> \t`FETCH_HEAD`, ...\"\n\nIsn't `HEAD` supposed to be a \"symbolic ref\"?\n\nIt definitely seems some explanation is missing.\n\n-- \nFelipe Contreras\n"},{"id":"475433","messageId":"643a37acadf7f_1466294bb@chronos.notmuch","threadId":"59598","inReplyTo":"ZDnCMegeiw0kT5oj@nand.local","subject":"Re: [PATCH 1/5] revisions.txt: document more special refs","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2023-04-15T05:35:40Z","receivedAt":"2023-04-15T05:35:46Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Taylor Blau wrote:\n> On Fri, Apr 14, 2023 at 12:49:16PM -0700, Victoria Dye wrote:\n> > To help with that, you could create visual separation in the rendered doc by\n> > adding a '+' between each special ref description; converting them into a\n> > bullet pointed list would also work, I think.\n> \n> In case you're looking for another option, you could convert these into\n> a description list, which would be consistent with the outer-most list\n> in this document.\n> \n> I had to refresh myself on how the spacing and continuations work in\n> ASCIIdoc, but I think the following (which applies on top of this patch)\n> is right:\n\nFortunately it's easy to test:\n\n  asciidoctor - <<\\EOF >foo.html\n    `HEAD`:::\n      names the commit on which you based the changes in the working tree.\n    `FETCH_HEAD`:::\n      records the branch which you fetched from a remote repository with\n      your last `git fetch` invocation.\n  EOF\n\nYes, the format is fine, I'd just use `::` instead of `:::` as that's generally\nthe first level, but in practical terms doesn't really matter.\n\nhttps://docs.asciidoctor.org/asciidoc/latest/lists/description/\n\nCheers.\n\n-- \nFelipe Contreras\n"},{"id":"475435","messageId":"CABPp-BHyvVhVKa+M-GYTG3OEmgmoaEij15BFXQ6oyDDsboxS9g@mail.gmail.com","threadId":"59598","inReplyTo":"0cdd4ab3d739e07357ea9efef2cdece633db6ebb.1681495119.git.gitgitgadget@gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-15T07:03:35Z","receivedAt":"2023-04-15T07:03:54Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Apr 14, 2023 at 10:58 AM Philippe Blain via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n>\n> From: Philippe Blain <levraiphilippeblain@gmail.com>\n>\n> Since 5291828df8 (merge-ort: write $GIT_DIR/AUTO_MERGE whenever we hit a\n> conflict, 2021-03-20), when using the 'ort' merge strategy, the special\n> ref AUTO_MERGE is written when a merge operation results in conflicts.\n> This ref points to a tree recording the conflicted state of the working\n> tree and is very useful during conflict resolution. However, this ref is\n> not documented.\n>\n> Add some documentation for AUTO_MERGE in git-diff(1), git-merge(1),\n> gitrevisions(7) and in the user manual.\n>\n> In git-diff(1), mention it at the end of the description section, when\n> we mention that the command also accepts trees instead of commits, and\n> also add an invocation to the \"Various ways to check your working tree\"\n> example.\n>\n> In git-merge(1), add a step to the list of things that happen \"when it\n> is not obvious how to reconcile the changes\", under the \"True merge\"\n> secion. Also mention AUTO_MERGE in the \"How to resolve conflicts\"\n\ns/secion/section/\n\n> section, when mentioning 'git diff'.\n>\n> In gitrevisions(7), add a mention of AUTO_MERGE along with the other\n> special refs.\n>\n> In the user manual, add a paragraph describing AUTO_MERGE to the\n> \"Getting conflict-resolution help during a merge\" section, and include\n> an example of a 'git diff AUTO_MERGE' invocation for the example\n> conflict used in that section. Note that for uniformity we do not use\n> backticks around AUTO_MERGE here since the rest of the document does not\n> typeset special refs differently.\n>\n> Closes: https://github.com/gitgitgadget/git/issues/1471\n> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> ---\n>  Documentation/git-diff.txt    |  8 +++++++-\n>  Documentation/git-merge.txt   |  9 +++++++--\n>  Documentation/revisions.txt   |  6 +++++-\n>  Documentation/user-manual.txt | 27 +++++++++++++++++++++++++++\n>  4 files changed, 46 insertions(+), 4 deletions(-)\n>\n> diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\n> index 52b679256c4..a85cc756ebc 100644\n> --- a/Documentation/git-diff.txt\n> +++ b/Documentation/git-diff.txt\n> @@ -102,7 +102,11 @@ If --merge-base is given, use the merge base of the two commits for the\n>  Just in case you are doing something exotic, it should be\n>  noted that all of the <commit> in the above description, except\n>  in the `--merge-base` case and in the last two forms that use `..`\n> -notations, can be any <tree>.\n> +notations, can be any <tree>. A tree of interest is the one pointed to\n> +by the special ref `AUTO_MERGE`, which is written by the 'ort' merge\n> +strategy upon hitting merge conflicts (see linkgit:git-merge[1]).\n> +Comparing the working tree with `AUTO_MERGE` shows changes you've made\n> +so far to resolve conflicts (see the examples below).\n>\n>  For a more complete list of ways to spell <commit>, see\n>  \"SPECIFYING REVISIONS\" section in linkgit:gitrevisions[7].\n> @@ -152,6 +156,7 @@ Various ways to check your working tree::\n>  $ git diff            <1>\n>  $ git diff --cached   <2>\n>  $ git diff HEAD       <3>\n> +$ git diff AUTO_MERGE <4>\n>  ------------\n>  +\n>  <1> Changes in the working tree not yet staged for the next commit.\n> @@ -159,6 +164,7 @@ $ git diff HEAD       <3>\n>      would be committing if you run `git commit` without `-a` option.\n>  <3> Changes in the working tree since your last commit; what you\n>      would be committing if you run `git commit -a`\n> +<4> Changes in the working tree you've made to resolve conflicts so far.\n>\n>  Comparing with arbitrary commits::\n>  +\n> diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\n> index 23aefe28851..3f61389c1c2 100644\n> --- a/Documentation/git-merge.txt\n> +++ b/Documentation/git-merge.txt\n> @@ -196,7 +196,11 @@ happens:\n>     can inspect the stages with `git ls-files -u`).  The working\n>     tree files contain the result of the merge operation; i.e. 3-way\n>     merge results with familiar conflict markers `<<<` `===` `>>>`.\n> -5. No other changes are made.  In particular, the local\n> +5. A special ref `AUTO_MERGE` is written, pointing to a tree corresponding\n> +   to the current content of the working tree (including conflict markers).\n> +   Note that this ref is only written when the 'ort' merge strategy\n> +   is used (the default).\n> +6. No other changes are made.  In particular, the local\n>     modifications you had before you started merge will stay the\n>     same and the index entries for them stay as they were,\n>     i.e. matching `HEAD`.\n> @@ -336,7 +340,8 @@ You can work through the conflict with a number of tools:\n>\n>   * Look at the diffs.  `git diff` will show a three-way diff,\n>     highlighting changes from both the `HEAD` and `MERGE_HEAD`\n> -   versions.\n> +   versions. `git diff AUTO_MERGE` will show what changes you've\n> +   made so far to resolve conlicts.\n\ns/conlicts/conflicts/\n\n>\n>   * Look at the diffs from each branch. `git log --merge -p <path>`\n>     will show diffs first for the `HEAD` version and then the\n> diff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\n> index 98b8f89bc8d..b42a2bb30a5 100644\n> --- a/Documentation/revisions.txt\n> +++ b/Documentation/revisions.txt\n> @@ -33,7 +33,8 @@ characters and to avoid word splitting.\n>\n>    . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n>      useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n> -    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n> +    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD`, `BISECT_HEAD`\n> +    and `AUTO_MERGE`);\n>\n>    . otherwise, 'refs/<refname>' if it exists;\n>\n> @@ -64,6 +65,9 @@ run `git revert`.\n>  when you run `git cherry-pick`.\n>  `BISECT_HEAD` records the current commit to be tested when you\n>  run `git bisect --no-checkout`.\n> +`AUTO_MERGE` records a tree object corresponding to the state the\n> +'ort' merge strategy wrote to the working tree when a merge operation\n> +resulted in conflicts.\n>  +\n>  Note that any of the 'refs/*' cases above may come either from\n>  the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\n> index dc9c6a663a9..99e5f652e92 100644\n> --- a/Documentation/user-manual.txt\n> +++ b/Documentation/user-manual.txt\n> @@ -1343,6 +1343,33 @@ $ git diff -3 file.txt           # diff against stage 3\n>  $ git diff --theirs file.txt   # same as the above.\n>  -------------------------------------------------\n>\n> +When using the 'ort' merge strategy (the default), before updating the working\n> +tree with the result of the merge, Git writes a special ref named AUTO_MERGE\n> +reflecting the state of the tree it is about to write. Conflicted paths that\n> +could not be automatically merged are written to this tree with conflict\n> +markers, just as in the working tree. AUTO_MERGE can thus be used with\n> +linkgit:git-diff[1] to show the changes you've made so far to resolve\n> +conflicts. Using the same example as above, after resolving the conflict we\n> +get:\n\nMostly...  To clarify, conflicted paths *with a textual conflict* are\nwritten with conflict markers.  Conflicted paths with non-textual\nconflicts are not.  There are several conflict types that fall into\nthe non-textual conflict umbrella: binary files, file/directory,\nsymlink/directory, symlink/file, modify/delete, rename/add,\nrename/delete, rename/rename (1to2), and various submodule and\ndirectory rename conflict types as well.\n\nThe AUTO_MERGE stuff will only help with seeing how textual conflicts\nwere resolved, it's not much help with the non-textual conflicts.\n\n(By contrast, the closely related --remerge-diff option to `git log`\nor `git show` does help see the resolution of *both* the textual and\nnon-textual conflicts, but of course one can't use that option on the\ncurrent merge until after first commiting the existing changes.)\n\n\n\n> +\n> +-------------------------------------------------\n> +$ git diff AUTO_MERGE\n> +diff --git a/file.txt b/file.txt\n> +index cd10406..8bf5ae7 100644\n> +--- a/file.txt\n> ++++ b/file.txt\n> +@@ -1,5 +1 @@\n> +-<<<<<<< HEAD:file.txt\n> +-Hello world\n> +-=======\n> +-Goodbye\n> +->>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n> ++Goodbye world\n> +-------------------------------------------------\n> +\n> +Notice that the diff shows we deleted the conflict markers and both versions,\n> +and wrote \"Goodbye world\" instead.\n> +\n>  The linkgit:git-log[1] and linkgit:gitk[1] commands also provide special help\n>  for merges:\n>\n> --\n> gitgitgadget\n>\n"},{"id":"475436","messageId":"CABPp-BH=LQdjn4yjtCJrPZVHLAZPC0895NYpyUfE92+TKcUsbg@mail.gmail.com","threadId":"59598","inReplyTo":"CAPig+cQQVby2g+_kfucbYdwOZW5_CEyyyOex=4hXoCJt7TkjeA@mail.gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-15T07:08:17Z","receivedAt":"2023-04-15T07:08:35Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Apr 14, 2023 at 10:08 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> On Fri, Apr 14, 2023 at 2:13 PM Philippe Blain via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n> > Add some documentation for AUTO_MERGE in git-diff(1), git-merge(1),\n> > gitrevisions(7) and in the user manual.\n> >\n> > Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n> > ---\n> > diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\n> > @@ -1343,6 +1343,33 @@ $ git diff -3 file.txt           # diff against stage 3\n> > +-------------------------------------------------\n> > +$ git diff AUTO_MERGE\n> > +diff --git a/file.txt b/file.txt\n> > +index cd10406..8bf5ae7 100644\n> > +--- a/file.txt\n> > ++++ b/file.txt\n> > +@@ -1,5 +1 @@\n> > +-<<<<<<< HEAD:file.txt\n> > +-Hello world\n> > +-=======\n> > +-Goodbye\n> > +->>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n> > ++Goodbye world\n> > +-------------------------------------------------\n> > +\n> > +Notice that the diff shows we deleted the conflict markers and both versions,\n> > +and wrote \"Goodbye world\" instead.\n>\n> Some grammatical problem here. Perhaps s/and both/in both/, or maybe\n> just drop \"and both versions\"?\n\nIt reads correctly as-is to me.  There were five lines dropped:\n  * Three were lines starting with '<', '=', and '>' characters,\nreferred to as the conflict marker lines.\n  * Two were lines containing content from each of the sides (\"Hello\nworld\", and \"Goodbye\")\nand one line added.\n\nThus, the diff shows we deleted the conflict markers (the 1st, 3rd and\n5th lines) and both versions (lines 2 and 4), and wrote \"Goodbye\nworld\" instead.\n"},{"id":"475437","messageId":"CABPp-BFCv4rk6Z3jhqCSs0p59vVdhSvdmc2kSBFUnwsCuj5rng@mail.gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"Re: [PATCH 0/5] Document 'AUTO_MERGE' and more special refs","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-15T07:09:11Z","receivedAt":"2023-04-15T07:09:29Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Apr 14, 2023 at 10:58 AM Philippe Blain via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n>\n> This series adds documentation (and completion!) for AUTO_MERGE. In doing so\n> I noticed that some other special refs where not mentioned in 'gitrevisions'\n> nor suggested by the completion, so I also tried to improve that.\n>\n> Since the changes are in the same parts of the same files, I thought it made\n> more sense to send everything in the same series to avoid conflicts, but I\n> can send the AUTO_MERGE patches on top of the other ones in a separate\n> series if that would be preferred.\n>\n> Here is a breakdown of the patches. First the \"other special refs\" patches:\n>\n>  * [PATCH 1/5] revisions.txt: document more special refs\n>  * [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD\n>\n> Then a preparatory cleanup for the AUTO_MERGE patches:\n>\n>  * [PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section\n>\n> Finally the AUTO_MERGE patches:\n>\n>  * [PATCH 4/5] Documentation: document AUTO_MERGE\n>  * [PATCH 5/5] completion: complete AUTO_MERGE\n>\n> Thanks Elijah for this very useful feature! Dscho, I'm CC-ing you since you\n> opened https://github.com/gitgitgadget/git/issues/1471, I hope that's OK.\n\nSweet, thanks for sending this in.  I like the little touches you\nadded such as 3/5,\nand fixing up docs of other refs.\n\nI found a couple typos and some slightly misleading text in 4/5.\n\nI'm also curious if it'd be worth attempting to point out the link\nbetween AUTO_MERGE and the --remerge-diff flag to `git log` and `git\nshow`, though even if it is, it could always be added after this\nseries.\n"},{"id":"475439","messageId":"CAPig+cSYJw3_eJSLr0ygPDj21vcdVK5NT1h_g1PrhA4vM+uiOA@mail.gmail.com","threadId":"59598","inReplyTo":"CABPp-BH=LQdjn4yjtCJrPZVHLAZPC0895NYpyUfE92+TKcUsbg@mail.gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2023-04-15T08:55:38Z","receivedAt":"2023-04-15T08:55:54Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sat, Apr 15, 2023 at 3:08 AM Elijah Newren <newren@gmail.com> wrote:\n> On Fri, Apr 14, 2023 at 10:08 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > On Fri, Apr 14, 2023 at 2:13 PM Philippe Blain via GitGitGadget\n> > <gitgitgadget@gmail.com> wrote:\n> > > +Notice that the diff shows we deleted the conflict markers and both versions,\n> > > +and wrote \"Goodbye world\" instead.\n> >\n> > Some grammatical problem here. Perhaps s/and both/in both/, or maybe\n> > just drop \"and both versions\"?\n>\n> It reads correctly as-is to me.  There were five lines dropped:\n>   * Three were lines starting with '<', '=', and '>' characters,\n> referred to as the conflict marker lines.\n>   * Two were lines containing content from each of the sides (\"Hello\n> world\", and \"Goodbye\")\n> and one line added.\n>\n> Thus, the diff shows we deleted the conflict markers (the 1st, 3rd and\n> 5th lines) and both versions (lines 2 and 4), and wrote \"Goodbye\n> world\" instead.\n\nYes, upon rereading it, I can interpret it in the way it was intended.\nOn my initial read-through, it sounded wrong. Perhaps, had it said\n\"and both versions of the content line\" or such, it wouldn't have\ntripped me up.\n"},{"id":"475443","messageId":"5cd89e46-f099-24bb-ebe4-fabdd6f94aef@gmail.com","threadId":"59598","inReplyTo":"CABPp-BHyvVhVKa+M-GYTG3OEmgmoaEij15BFXQ6oyDDsboxS9g@mail.gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Philippe Blain","fromEmail":"levraiphilippeblain@gmail.com","sentAt":"2023-04-15T15:36:54Z","receivedAt":"2023-04-15T15:37:03Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Hi Elijah,\n\nLe 2023-04-15 à 03:03, Elijah Newren a écrit :\n> On Fri, Apr 14, 2023 at 10:58 AM Philippe Blain via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n>>\n\nThanks for pointing out my typos, those are fixed.\n\n>> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\n>> index dc9c6a663a9..99e5f652e92 100644\n>> --- a/Documentation/user-manual.txt\n>> +++ b/Documentation/user-manual.txt\n>> @@ -1343,6 +1343,33 @@ $ git diff -3 file.txt           # diff against stage 3\n>>  $ git diff --theirs file.txt   # same as the above.\n>>  -------------------------------------------------\n>>\n>> +When using the 'ort' merge strategy (the default), before updating the working\n>> +tree with the result of the merge, Git writes a special ref named AUTO_MERGE\n>> +reflecting the state of the tree it is about to write. Conflicted paths that\n>> +could not be automatically merged are written to this tree with conflict\n>> +markers, just as in the working tree. AUTO_MERGE can thus be used with\n>> +linkgit:git-diff[1] to show the changes you've made so far to resolve\n>> +conflicts. Using the same example as above, after resolving the conflict we\n>> +get:\n> \n> Mostly...  To clarify, conflicted paths *with a textual conflict* are\n> written with conflict markers.  Conflicted paths with non-textual\n> conflicts are not.  There are several conflict types that fall into\n> the non-textual conflict umbrella: binary files, file/directory,\n> symlink/directory, symlink/file, modify/delete, rename/add,\n> rename/delete, rename/rename (1to2), and various submodule and\n> directory rename conflict types as well.\n> \n> The AUTO_MERGE stuff will only help with seeing how textual conflicts\n> were resolved, it's not much help with the non-textual conflicts.\n\nThat's true. I think that it might be a good idea to be explicit about\n\"textual conflicts\". Although, I think that precision should also be made\nin the other parts of the doc, not just the user manual, so I'll do that.\n\nThanks,\n\nPhilippe.\n\n> (By contrast, the closely related --remerge-diff option to `git log`\n> or `git show` does help see the resolution of *both* the textual and\n> non-textual conflicts, but of course one can't use that option on the\n> current merge until after first commiting the existing changes.)\n\nThat's true. And, remerge-diff only helps when actually looking at two-way\nmerge commit, not with conflicts hit during a rebase, cherry-pick or revert. \n\nA semi-related trick I use to check conflict resolution during a rebase (after\nresolving the conflicts but before 'git rebase --continue') is to manually \nconstruct a commit from the index and use 'git range-diff' to compare it\nto REBASE_HEAD. Thinking out loud, maybe a '--check-resolution' flag to the \nsequencer would make sense to do that automatically...\n"},{"id":"475451","messageId":"CABPp-BGtewvrsO_9hf5A4iqpTBW7VL1p8skwMGA+tFju1emQ4w@mail.gmail.com","threadId":"59598","inReplyTo":"5cd89e46-f099-24bb-ebe4-fabdd6f94aef@gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-15T23:31:01Z","receivedAt":"2023-04-15T23:33:04Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Sat, Apr 15, 2023 at 8:36 AM Philippe Blain\n<levraiphilippeblain@gmail.com> wrote:\n>\n> Hi Elijah,\n>\n<snip>\n> > (By contrast, the closely related --remerge-diff option to `git log`\n> > or `git show` does help see the resolution of *both* the textual and\n> > non-textual conflicts, but of course one can't use that option on the\n> > current merge until after first commiting the existing changes.)\n>\n> That's true. And, remerge-diff only helps when actually looking at two-way\n> merge commit, not with conflicts hit during a rebase, cherry-pick or revert.\n\nGood point.  I have a small patchset to create an option allowing\nfolks to see how conflicts were resolved in reverts, and in\ncherry-picks made with the -x option.  I made it over two years ago,\nbut never ended up deciding whether to submit it or not.  At some\npoint I put it up on gitgitgadget, at\nhttps://github.com/gitgitgadget/git/pull/1151.\n\nPoints against it are that it doesn't work for rebases (because we\ndon't know which commits they were taken from) or for many\ncherry-picks.  Given the lower utility, and the fact that it involves\ncommit message scraping (looking for \"reverts commit <X>\" and\n\"(cherry-picked from <X>)\"), I never ended up pushing for it.\n\n> A semi-related trick I use to check conflict resolution during a rebase (after\n> resolving the conflicts but before 'git rebase --continue') is to manually\n> construct a commit from the index and use 'git range-diff' to compare it\n> to REBASE_HEAD.\n\nHeh, I have a semi-related trick as well.  During rebases, when I want\nto compare overall diffs for the current commit against what it was\npicked from, I tend to use:\n   mydiff <(git log -1 -p REBASE_HEAD) <(git diff HEAD)\nwhere `mydiff` is a specialized wrapper around `git diff --no-index`\nthat actually reads the contents of /dev/fd/<value> instead of\ntreating it as a symlink.  (Though if I don't have that script handy,\nI just plug in `diff -u` for `mydiff`).\n"},{"id":"475476","messageId":"CABPp-BHyPEb1DGDy8OFq90G6QhAihZAnxsJorbxUDe+AMeJ2DA@mail.gmail.com","threadId":"59598","inReplyTo":"CAPig+cSYJw3_eJSLr0ygPDj21vcdVK5NT1h_g1PrhA4vM+uiOA@mail.gmail.com","subject":"Re: [PATCH 4/5] Documentation: document AUTO_MERGE","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-04-16T03:05:32Z","receivedAt":"2023-04-16T03:08:06Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Sat, Apr 15, 2023 at 1:55 AM Eric Sunshine <sunshine@sunshineco.com> wrote:\n>\n> On Sat, Apr 15, 2023 at 3:08 AM Elijah Newren <newren@gmail.com> wrote:\n> > On Fri, Apr 14, 2023 at 10:08 PM Eric Sunshine <sunshine@sunshineco.com> wrote:\n> > > On Fri, Apr 14, 2023 at 2:13 PM Philippe Blain via GitGitGadget\n> > > <gitgitgadget@gmail.com> wrote:\n> > > > +Notice that the diff shows we deleted the conflict markers and both versions,\n> > > > +and wrote \"Goodbye world\" instead.\n> > >\n> > > Some grammatical problem here. Perhaps s/and both/in both/, or maybe\n> > > just drop \"and both versions\"?\n> >\n> > It reads correctly as-is to me.  There were five lines dropped:\n> >   * Three were lines starting with '<', '=', and '>' characters,\n> > referred to as the conflict marker lines.\n> >   * Two were lines containing content from each of the sides (\"Hello\n> > world\", and \"Goodbye\")\n> > and one line added.\n> >\n> > Thus, the diff shows we deleted the conflict markers (the 1st, 3rd and\n> > 5th lines) and both versions (lines 2 and 4), and wrote \"Goodbye\n> > world\" instead.\n>\n> Yes, upon rereading it, I can interpret it in the way it was intended.\n> On my initial read-through, it sounded wrong. Perhaps, had it said\n> \"and both versions of the content line\" or such, it wouldn't have\n> tripped me up.\n\nThat suggestion reads well to me too.\n"},{"id":"475483","messageId":"CAPx1GveGz5h3xJ=603SY7G8yBFobPEY+uvLka9ykM5Z9QA_-uw@mail.gmail.com","threadId":"59598","inReplyTo":"CABPp-BFCv4rk6Z3jhqCSs0p59vVdhSvdmc2kSBFUnwsCuj5rng@mail.gmail.com","subject":"Re: [PATCH 0/5] Document 'AUTO_MERGE' and more special refs","fromName":"Chris Torek","fromEmail":"chris.torek@gmail.com","sentAt":"2023-04-16T10:26:51Z","receivedAt":"2023-04-16T10:27:08Z","isPatch":true,"sender":{"key":"chris.torek@gmail.com","avatar":"https://avatars.githubusercontent.com/u/16826774?v=4"},"body":"I wonder if it's worth mentioning that these pseudo-refs\nare really per-work-tree. A few too many add-ons to Git\nforget to take this into consideration...\n\nChris\n"},{"id":"477645","messageId":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.git.1681495119.gitgitgadget@gmail.com","subject":"[PATCH v2 0/6] Document 'AUTO_MERGE' and more special refs","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:28:55Z","receivedAt":"2023-05-22T19:29:11Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"Thanks everyone for the review!\n\nChanges since v1:\n\n * Addressed typos and wording suggestions from Elijah\n * Incoporated Eric's wording suggestion\n * Added a preliminary patch adressing Victoria's suggestion, based on the\n   what Taylor sent.\n\nThis version is not a \"fixups on top\", it's a complete new version. I don't\nsee the point of merging typos to master if we can instead wait for 'next'\nto be rebuilt after the upcoming release.\n\nv1: This series adds documentation (and completion!) for AUTO_MERGE. In\ndoing so I noticed that some other special refs where not mentioned in\n'gitrevisions' nor suggested by the completion, so I also tried to improve\nthat.\n\nSince the changes are in the same parts of the same files, I thought it made\nmore sense to send everything in the same series to avoid conflicts, but I\ncan send the AUTO_MERGE patches on top of the other ones in a separate\nseries if that would be preferred.\n\nHere is a breakdown of the patches. First the \"other special refs\" patches:\n\n * [PATCH 1/5] revisions.txt: document more special refs\n * [PATCH 2/5] completion: complete REVERT_HEAD and BISECT_HEAD\n\nThen a preparatory cleanup for the AUTO_MERGE patches:\n\n * [PATCH 3/5] git-merge.txt: modernize word choice in \"True merge\" section\n\nFinally the AUTO_MERGE patches:\n\n * [PATCH 4/5] Documentation: document AUTO_MERGE\n * [PATCH 5/5] completion: complete AUTO_MERGE\n\nThanks Elijah for this very useful feature! Dscho, I'm CC-ing you since you\nopened https://github.com/gitgitgadget/git/issues/1471, I hope that's OK.\n\nCheers,\n\nPhilippe.\n\nPhilippe Blain (6):\n  revisions.txt: use description list for special refs\n  revisions.txt: document more special refs\n  completion: complete REVERT_HEAD and BISECT_HEAD\n  git-merge.txt: modernize word choice in \"True merge\" section\n  Documentation: document AUTO_MERGE\n  completion: complete AUTO_MERGE\n\n Documentation/git-diff.txt             |  9 ++++-\n Documentation/git-merge.txt            | 11 ++++--\n Documentation/revisions.txt            | 50 ++++++++++++++++++--------\n Documentation/user-manual.txt          | 27 ++++++++++++++\n contrib/completion/git-completion.bash |  2 +-\n 5 files changed, 79 insertions(+), 20 deletions(-)\n\n\nbase-commit: a0f05f684010332ab3a706979d191b9157643f80\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-1515%2Fphil-blain%2Fdoc-auto-merge-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1515/phil-blain/doc-auto-merge-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/1515\n\nRange-diff vs v1:\n\n -:  ----------- > 1:  1bacd52a432 revisions.txt: use description list for special refs\n 1:  66c7e514157 ! 2:  3e3240a78f8 revisions.txt: document more special refs\n     @@ Commit message\n       ## Documentation/revisions.txt ##\n      @@ Documentation/revisions.txt: characters and to avoid word splitting.\n         first match in the following rules:\n     - \n     + +\n         . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n      -    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n      -    and `CHERRY_PICK_HEAD`);\n     @@ Documentation/revisions.txt: characters and to avoid word splitting.\n       \n         . otherwise, 'refs/<refname>' if it exists;\n       \n     -@@ Documentation/revisions.txt: you can easily change the tip of the branch back to the state before you ran\n     - them.\n     - `MERGE_HEAD` records the commit(s) which you are merging into your branch\n     - when you run `git merge`.\n     -+`REBASE_HEAD`, during a rebase, records the commit at which the\n     -+operation is currently stopped, either because of conflicts or an `edit`\n     -+command in an interactive rebase.\n     -+`REVERT_HEAD` records the commit which you are reverting when you\n     -+run `git revert`.\n     - `CHERRY_PICK_HEAD` records the commit which you are cherry-picking\n     - when you run `git cherry-pick`.\n     -+`BISECT_HEAD` records the current commit to be tested when you\n     -+run `git bisect --no-checkout`.\n     +@@ Documentation/revisions.txt: characters and to avoid word splitting.\n     +   `MERGE_HEAD`:::\n     +     records the commit(s) which you are merging into your branch when you\n     +     run `git merge`.\n     ++  `REBASE_HEAD`:::\n     ++    during a rebase, records the commit at which the operation is\n     ++    currently stopped, either because of conflicts or an `edit` command in\n     ++    an interactive rebase.\n     ++  `REVERT_HEAD`:::\n     ++    records the commit which you are reverting when you run `git revert`.\n     +   `CHERRY_PICK_HEAD`:::\n     +     records the commit which you are cherry-picking when you run `git\n     +     cherry-pick`.\n     ++  `BISECT_HEAD`:::\n     ++    records the current commit to be tested when you run `git bisect\n     ++    --no-checkout`.\n     + \n       +\n       Note that any of the 'refs/*' cases above may come either from\n     - the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n 2:  f3a47758f9d = 3:  70487d66459 completion: complete REVERT_HEAD and BISECT_HEAD\n 3:  62b68829c5a ! 4:  f1d99453f54 git-merge.txt: modernize word choice in \"True merge\" section\n     @@ Commit message\n      \n          The \"True merge\" section of the 'git merge' documentation mentions that\n          in case of conflicts, the conflicted working tree files contain \"the\n     -    result of the \"merge\" program\". This probably refers to RCS' 'merge'\n     +    result of the \"merge\" program\". This probably refers to RCS's 'merge'\n          program, which is mentioned further down under \"How conflicts are\n          presented\".\n      \n 4:  0cdd4ab3d73 ! 5:  612073d9508 Documentation: document AUTO_MERGE\n     @@ Commit message\n      \n          In git-merge(1), add a step to the list of things that happen \"when it\n          is not obvious how to reconcile the changes\", under the \"True merge\"\n     -    secion. Also mention AUTO_MERGE in the \"How to resolve conflicts\"\n     +    section. Also mention AUTO_MERGE in the \"How to resolve conflicts\"\n          section, when mentioning 'git diff'.\n      \n          In gitrevisions(7), add a mention of AUTO_MERGE along with the other\n     @@ Documentation/git-diff.txt: If --merge-base is given, use the merge base of the\n      +by the special ref `AUTO_MERGE`, which is written by the 'ort' merge\n      +strategy upon hitting merge conflicts (see linkgit:git-merge[1]).\n      +Comparing the working tree with `AUTO_MERGE` shows changes you've made\n     -+so far to resolve conflicts (see the examples below).\n     ++so far to resolve textual conflicts (see the examples below).\n       \n       For a more complete list of ways to spell <commit>, see\n       \"SPECIFYING REVISIONS\" section in linkgit:gitrevisions[7].\n     @@ Documentation/git-diff.txt: $ git diff HEAD       <3>\n           would be committing if you run `git commit` without `-a` option.\n       <3> Changes in the working tree since your last commit; what you\n           would be committing if you run `git commit -a`\n     -+<4> Changes in the working tree you've made to resolve conflicts so far.\n     ++<4> Changes in the working tree you've made to resolve textual\n     ++    conflicts so far.\n       \n       Comparing with arbitrary commits::\n       +\n     @@ Documentation/git-merge.txt: happens:\n          tree files contain the result of the merge operation; i.e. 3-way\n          merge results with familiar conflict markers `<<<` `===` `>>>`.\n      -5. No other changes are made.  In particular, the local\n     -+5. A special ref `AUTO_MERGE` is written, pointing to a tree corresponding\n     -+   to the current content of the working tree (including conflict markers).\n     -+   Note that this ref is only written when the 'ort' merge strategy\n     -+   is used (the default).\n     ++5. A special ref `AUTO_MERGE` is written, pointing to a tree\n     ++   corresponding to the current content of the working tree (including\n     ++   conflict markers for textual conflicts).  Note that this ref is only\n     ++   written when the 'ort' merge strategy is used (the default).\n      +6. No other changes are made.  In particular, the local\n          modifications you had before you started merge will stay the\n          same and the index entries for them stay as they were,\n     @@ Documentation/git-merge.txt: You can work through the conflict with a number of\n          highlighting changes from both the `HEAD` and `MERGE_HEAD`\n      -   versions.\n      +   versions. `git diff AUTO_MERGE` will show what changes you've\n     -+   made so far to resolve conlicts.\n     ++   made so far to resolve textual conflicts.\n       \n        * Look at the diffs from each branch. `git log --merge -p <path>`\n          will show diffs first for the `HEAD` version and then the\n      \n       ## Documentation/revisions.txt ##\n      @@ Documentation/revisions.txt: characters and to avoid word splitting.\n     - \n     + +\n         . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n           useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n      -    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n     @@ Documentation/revisions.txt: characters and to avoid word splitting.\n       \n         . otherwise, 'refs/<refname>' if it exists;\n       \n     -@@ Documentation/revisions.txt: run `git revert`.\n     - when you run `git cherry-pick`.\n     - `BISECT_HEAD` records the current commit to be tested when you\n     - run `git bisect --no-checkout`.\n     -+`AUTO_MERGE` records a tree object corresponding to the state the\n     -+'ort' merge strategy wrote to the working tree when a merge operation\n     -+resulted in conflicts.\n     +@@ Documentation/revisions.txt: characters and to avoid word splitting.\n     +   `BISECT_HEAD`:::\n     +     records the current commit to be tested when you run `git bisect\n     +     --no-checkout`.\n     ++  `AUTO_MERGE`:::\n     ++    records a tree object corresponding to the state the\n     ++    'ort' merge strategy wrote to the working tree when a merge operation\n     ++    resulted in conflicts.\n     + \n       +\n       Note that any of the 'refs/*' cases above may come either from\n     - the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n      \n       ## Documentation/user-manual.txt ##\n      @@ Documentation/user-manual.txt: $ git diff -3 file.txt\t\t# diff against stage 3\n     @@ Documentation/user-manual.txt: $ git diff -3 file.txt\t\t# diff against stage 3\n       \n      +When using the 'ort' merge strategy (the default), before updating the working\n      +tree with the result of the merge, Git writes a special ref named AUTO_MERGE\n     -+reflecting the state of the tree it is about to write. Conflicted paths that\n     -+could not be automatically merged are written to this tree with conflict\n     -+markers, just as in the working tree. AUTO_MERGE can thus be used with\n     -+linkgit:git-diff[1] to show the changes you've made so far to resolve\n     ++reflecting the state of the tree it is about to write. Conflicted paths with\n     ++textual conflicts that could not be automatically merged are written to this\n     ++tree with conflict markers, just as in the working tree. AUTO_MERGE can thus be\n     ++used with linkgit:git-diff[1] to show the changes you've made so far to resolve\n      +conflicts. Using the same example as above, after resolving the conflict we\n      +get:\n      +\n     @@ -1,5 +1 @@\n      ++Goodbye world\n      +-------------------------------------------------\n      +\n     -+Notice that the diff shows we deleted the conflict markers and both versions,\n     -+and wrote \"Goodbye world\" instead.\n     ++Notice that the diff shows we deleted the conflict markers and both versions of\n     ++the content line, and wrote \"Goodbye world\" instead.\n      +\n       The linkgit:git-log[1] and linkgit:gitk[1] commands also provide special help\n       for merges:\n 5:  88cc7a80f31 = 6:  17226c56e7b completion: complete AUTO_MERGE\n\n-- \ngitgitgadget\n"},{"id":"477646","messageId":"1bacd52a432ecb89bc41b49a9e6317f8a5b15171.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 1/6] revisions.txt: use description list for special refs","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:28:56Z","receivedAt":"2023-05-22T19:29:16Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe special refs listed in 'gitrevisions' (under the '<refname>' entry)\nare on separate lines in the Asciidoc source, but end up as a single\ncontinuous paragraph in the rendered documentation (see e.g. [1]). In\nfollowing commits we will mention additional special refs, so to improve\nlegibility, use a description list such that every entry appears on its\nown line. Since we are already in a description list, use ':::' as the\nterm delimiter.\n\nIn order for the new description list to be aligned with the description\nunder the '<refname>' entry, instead of being aligned with the last\nentry of the \"in the following rules\" nested list, use the \"ancestor\nlist continuation\" syntax [2], i.e., leave an empty line before the\ncontinuation '+'. Do the same for the paragraph following the new\ndescription list (\"Note that any...\").\n\nWhile at it, also use a continuation '+' before the \"in the following\nrules\" list, for correctness. The parser seems not to care here, but\nit's best to keep the sources correct.\n\n[1] https://git-scm.com/docs/gitrevisions#Documentation/gitrevisions.txt-emltrefnamegtemegemmasterememheadsmasterememrefsheadsmasterem\n[2] https://docs.asciidoctor.org/asciidoc/latest/lists/continuation/#ancestor-list-continuation\n\nSuggested-by: Victoria Dye <vdye@github.com>\nBased-on-patch-by: Taylor Blau <me@ttaylorr.com>\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/revisions.txt | 32 +++++++++++++++++++-------------\n 1 file changed, 19 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex 9aa58052bc7..ab5b8cf880b 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -30,7 +30,7 @@ characters and to avoid word splitting.\n   explicitly say 'heads/master' to tell Git which one you mean.\n   When ambiguous, a '<refname>' is disambiguated by taking the\n   first match in the following rules:\n-\n++\n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n     useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n     and `CHERRY_PICK_HEAD`);\n@@ -44,19 +44,25 @@ characters and to avoid word splitting.\n   . otherwise, 'refs/remotes/<refname>' if it exists;\n \n   . otherwise, 'refs/remotes/<refname>/HEAD' if it exists.\n+\n +\n-`HEAD` names the commit on which you based the changes in the working tree.\n-`FETCH_HEAD` records the branch which you fetched from a remote repository\n-with your last `git fetch` invocation.\n-`ORIG_HEAD` is created by commands that move your `HEAD` in a drastic\n-way (`git am`, `git merge`, `git rebase`, `git reset`),\n-to record the position of the `HEAD` before their operation, so that\n-you can easily change the tip of the branch back to the state before you ran\n-them.\n-`MERGE_HEAD` records the commit(s) which you are merging into your branch\n-when you run `git merge`.\n-`CHERRY_PICK_HEAD` records the commit which you are cherry-picking\n-when you run `git cherry-pick`.\n+  `HEAD`:::\n+    names the commit on which you based the changes in the working tree.\n+  `FETCH_HEAD`:::\n+    records the branch which you fetched from a remote repository with\n+    your last `git fetch` invocation.\n+  `ORIG_HEAD`:::\n+    is created by commands that move your `HEAD` in a drastic way (`git\n+    am`, `git merge`, `git rebase`, `git reset`), to record the position\n+    of the `HEAD` before their operation, so that you can easily change\n+    the tip of the branch back to the state before you ran them.\n+  `MERGE_HEAD`:::\n+    records the commit(s) which you are merging into your branch when you\n+    run `git merge`.\n+  `CHERRY_PICK_HEAD`:::\n+    records the commit which you are cherry-picking when you run `git\n+    cherry-pick`.\n+\n +\n Note that any of the 'refs/*' cases above may come either from\n the `$GIT_DIR/refs` directory or from the `$GIT_DIR/packed-refs` file.\n-- \ngitgitgadget\n\n"},{"id":"477647","messageId":"3e3240a78f81d7886fa47bc26b859a4d7d238aff.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 2/6] revisions.txt: document more special refs","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:28:57Z","receivedAt":"2023-05-22T19:29:18Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nSome special refs, namely HEAD, FETCH_HEAD, ORIG_HEAD, MERGE_HEAD and\nCHERRY_PICK_HEAD, are mentioned and described in 'gitrevisions', but some\nothers, namely REBASE_HEAD, REVERT_HEAD, and BISECT_HEAD, are not.\n\nAdd a small description of these special refs.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/revisions.txt | 13 +++++++++++--\n 1 file changed, 11 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex ab5b8cf880b..b34f981622b 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -32,8 +32,8 @@ characters and to avoid word splitting.\n   first match in the following rules:\n +\n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n-    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`\n-    and `CHERRY_PICK_HEAD`);\n+    useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n+    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n \n   . otherwise, 'refs/<refname>' if it exists;\n \n@@ -59,9 +59,18 @@ characters and to avoid word splitting.\n   `MERGE_HEAD`:::\n     records the commit(s) which you are merging into your branch when you\n     run `git merge`.\n+  `REBASE_HEAD`:::\n+    during a rebase, records the commit at which the operation is\n+    currently stopped, either because of conflicts or an `edit` command in\n+    an interactive rebase.\n+  `REVERT_HEAD`:::\n+    records the commit which you are reverting when you run `git revert`.\n   `CHERRY_PICK_HEAD`:::\n     records the commit which you are cherry-picking when you run `git\n     cherry-pick`.\n+  `BISECT_HEAD`:::\n+    records the current commit to be tested when you run `git bisect\n+    --no-checkout`.\n \n +\n Note that any of the 'refs/*' cases above may come either from\n-- \ngitgitgadget\n\n"},{"id":"477648","messageId":"f1d99453f54fa08c5eb38340d50cb984fc4eb7a0.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 4/6] git-merge.txt: modernize word choice in \"True merge\" section","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:28:59Z","receivedAt":"2023-05-22T19:29:19Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe \"True merge\" section of the 'git merge' documentation mentions that\nin case of conflicts, the conflicted working tree files contain \"the\nresult of the \"merge\" program\". This probably refers to RCS's 'merge'\nprogram, which is mentioned further down under \"How conflicts are\npresented\".\n\nSince it is not clear at that point of the document which program is\nreferred to, and since most modern readers probably do not relate to RCS\nanyway, let's just write \"the merge operation\" instead.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/git-merge.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\nindex 0aeff572a59..23aefe28851 100644\n--- a/Documentation/git-merge.txt\n+++ b/Documentation/git-merge.txt\n@@ -194,7 +194,7 @@ happens:\n    versions: stage 1 stores the version from the common ancestor,\n    stage 2 from `HEAD`, and stage 3 from `MERGE_HEAD` (you\n    can inspect the stages with `git ls-files -u`).  The working\n-   tree files contain the result of the \"merge\" program; i.e. 3-way\n+   tree files contain the result of the merge operation; i.e. 3-way\n    merge results with familiar conflict markers `<<<` `===` `>>>`.\n 5. No other changes are made.  In particular, the local\n    modifications you had before you started merge will stay the\n-- \ngitgitgadget\n\n"},{"id":"477649","messageId":"70487d664591f1a201ce5711b16521873f80dbee.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 3/6] completion: complete REVERT_HEAD and BISECT_HEAD","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:28:58Z","receivedAt":"2023-05-22T19:29:21Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe pseudorefs REVERT_HEAD and BISECT_HEAD are not suggested\nby the __git_refs function. Add them there.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex dc95c34cc85..bcda376735c 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -767,7 +767,7 @@ __git_refs ()\n \t\t\ttrack=\"\"\n \t\t\t;;\n \t\t*)\n-\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD; do\n+\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do\n \t\t\t\tcase \"$i\" in\n \t\t\t\t$match*|$umatch*)\n \t\t\t\t\tif [ -e \"$dir/$i\" ]; then\n-- \ngitgitgadget\n\n"},{"id":"477650","messageId":"612073d9508223408100f7c8b9c514012144205f.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 5/6] Documentation: document AUTO_MERGE","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:29:00Z","receivedAt":"2023-05-22T19:29:26Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nSince 5291828df8 (merge-ort: write $GIT_DIR/AUTO_MERGE whenever we hit a\nconflict, 2021-03-20), when using the 'ort' merge strategy, the special\nref AUTO_MERGE is written when a merge operation results in conflicts.\nThis ref points to a tree recording the conflicted state of the working\ntree and is very useful during conflict resolution. However, this ref is\nnot documented.\n\nAdd some documentation for AUTO_MERGE in git-diff(1), git-merge(1),\ngitrevisions(7) and in the user manual.\n\nIn git-diff(1), mention it at the end of the description section, when\nwe mention that the command also accepts trees instead of commits, and\nalso add an invocation to the \"Various ways to check your working tree\"\nexample.\n\nIn git-merge(1), add a step to the list of things that happen \"when it\nis not obvious how to reconcile the changes\", under the \"True merge\"\nsection. Also mention AUTO_MERGE in the \"How to resolve conflicts\"\nsection, when mentioning 'git diff'.\n\nIn gitrevisions(7), add a mention of AUTO_MERGE along with the other\nspecial refs.\n\nIn the user manual, add a paragraph describing AUTO_MERGE to the\n\"Getting conflict-resolution help during a merge\" section, and include\nan example of a 'git diff AUTO_MERGE' invocation for the example\nconflict used in that section. Note that for uniformity we do not use\nbackticks around AUTO_MERGE here since the rest of the document does not\ntypeset special refs differently.\n\nCloses: https://github.com/gitgitgadget/git/issues/1471\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n Documentation/git-diff.txt    |  9 ++++++++-\n Documentation/git-merge.txt   |  9 +++++++--\n Documentation/revisions.txt   |  7 ++++++-\n Documentation/user-manual.txt | 27 +++++++++++++++++++++++++++\n 4 files changed, 48 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 52b679256c4..08087ffad5f 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -102,7 +102,11 @@ If --merge-base is given, use the merge base of the two commits for the\n Just in case you are doing something exotic, it should be\n noted that all of the <commit> in the above description, except\n in the `--merge-base` case and in the last two forms that use `..`\n-notations, can be any <tree>.\n+notations, can be any <tree>. A tree of interest is the one pointed to\n+by the special ref `AUTO_MERGE`, which is written by the 'ort' merge\n+strategy upon hitting merge conflicts (see linkgit:git-merge[1]).\n+Comparing the working tree with `AUTO_MERGE` shows changes you've made\n+so far to resolve textual conflicts (see the examples below).\n \n For a more complete list of ways to spell <commit>, see\n \"SPECIFYING REVISIONS\" section in linkgit:gitrevisions[7].\n@@ -152,6 +156,7 @@ Various ways to check your working tree::\n $ git diff            <1>\n $ git diff --cached   <2>\n $ git diff HEAD       <3>\n+$ git diff AUTO_MERGE <4>\n ------------\n +\n <1> Changes in the working tree not yet staged for the next commit.\n@@ -159,6 +164,8 @@ $ git diff HEAD       <3>\n     would be committing if you run `git commit` without `-a` option.\n <3> Changes in the working tree since your last commit; what you\n     would be committing if you run `git commit -a`\n+<4> Changes in the working tree you've made to resolve textual\n+    conflicts so far.\n \n Comparing with arbitrary commits::\n +\ndiff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt\nindex 23aefe28851..8625c5cb0ec 100644\n--- a/Documentation/git-merge.txt\n+++ b/Documentation/git-merge.txt\n@@ -196,7 +196,11 @@ happens:\n    can inspect the stages with `git ls-files -u`).  The working\n    tree files contain the result of the merge operation; i.e. 3-way\n    merge results with familiar conflict markers `<<<` `===` `>>>`.\n-5. No other changes are made.  In particular, the local\n+5. A special ref `AUTO_MERGE` is written, pointing to a tree\n+   corresponding to the current content of the working tree (including\n+   conflict markers for textual conflicts).  Note that this ref is only\n+   written when the 'ort' merge strategy is used (the default).\n+6. No other changes are made.  In particular, the local\n    modifications you had before you started merge will stay the\n    same and the index entries for them stay as they were,\n    i.e. matching `HEAD`.\n@@ -336,7 +340,8 @@ You can work through the conflict with a number of tools:\n \n  * Look at the diffs.  `git diff` will show a three-way diff,\n    highlighting changes from both the `HEAD` and `MERGE_HEAD`\n-   versions.\n+   versions. `git diff AUTO_MERGE` will show what changes you've\n+   made so far to resolve textual conflicts.\n \n  * Look at the diffs from each branch. `git log --merge -p <path>`\n    will show diffs first for the `HEAD` version and then the\ndiff --git a/Documentation/revisions.txt b/Documentation/revisions.txt\nindex b34f981622b..6ea6c7cead1 100644\n--- a/Documentation/revisions.txt\n+++ b/Documentation/revisions.txt\n@@ -33,7 +33,8 @@ characters and to avoid word splitting.\n +\n   . If '$GIT_DIR/<refname>' exists, that is what you mean (this is usually\n     useful only for `HEAD`, `FETCH_HEAD`, `ORIG_HEAD`, `MERGE_HEAD`,\n-    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD` and `BISECT_HEAD`);\n+    `REBASE_HEAD`, `REVERT_HEAD`, `CHERRY_PICK_HEAD`, `BISECT_HEAD`\n+    and `AUTO_MERGE`);\n \n   . otherwise, 'refs/<refname>' if it exists;\n \n@@ -71,6 +72,10 @@ characters and to avoid word splitting.\n   `BISECT_HEAD`:::\n     records the current commit to be tested when you run `git bisect\n     --no-checkout`.\n+  `AUTO_MERGE`:::\n+    records a tree object corresponding to the state the\n+    'ort' merge strategy wrote to the working tree when a merge operation\n+    resulted in conflicts.\n \n +\n Note that any of the 'refs/*' cases above may come either from\ndiff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt\nindex dc9c6a663a9..aa385137adc 100644\n--- a/Documentation/user-manual.txt\n+++ b/Documentation/user-manual.txt\n@@ -1343,6 +1343,33 @@ $ git diff -3 file.txt\t\t# diff against stage 3\n $ git diff --theirs file.txt\t# same as the above.\n -------------------------------------------------\n \n+When using the 'ort' merge strategy (the default), before updating the working\n+tree with the result of the merge, Git writes a special ref named AUTO_MERGE\n+reflecting the state of the tree it is about to write. Conflicted paths with\n+textual conflicts that could not be automatically merged are written to this\n+tree with conflict markers, just as in the working tree. AUTO_MERGE can thus be\n+used with linkgit:git-diff[1] to show the changes you've made so far to resolve\n+conflicts. Using the same example as above, after resolving the conflict we\n+get:\n+\n+-------------------------------------------------\n+$ git diff AUTO_MERGE\n+diff --git a/file.txt b/file.txt\n+index cd10406..8bf5ae7 100644\n+--- a/file.txt\n++++ b/file.txt\n+@@ -1,5 +1 @@\n+-<<<<<<< HEAD:file.txt\n+-Hello world\n+-=======\n+-Goodbye\n+->>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt\n++Goodbye world\n+-------------------------------------------------\n+\n+Notice that the diff shows we deleted the conflict markers and both versions of\n+the content line, and wrote \"Goodbye world\" instead.\n+\n The linkgit:git-log[1] and linkgit:gitk[1] commands also provide special help\n for merges:\n \n-- \ngitgitgadget\n\n"},{"id":"477651","messageId":"17226c56e7b8927c423d31ca2fa4c74859e65f86.1684783741.git.gitgitgadget@gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"[PATCH v2 6/6] completion: complete AUTO_MERGE","fromName":"Philippe Blain via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2023-05-22T19:29:01Z","receivedAt":"2023-05-22T19:29:28Z","isPatch":true,"sender":{"key":"levraiphilippeblain@gmail.com","avatar":"https://avatars.githubusercontent.com/u/44212482?v=4"},"body":"From: Philippe Blain <levraiphilippeblain@gmail.com>\n\nThe pseudoref AUTO_MERGE is documented since the previous commit. To\nmake it easier to use, let __git_refs in the Bash completion code\ncomplete it.\n\nSigned-off-by: Philippe Blain <levraiphilippeblain@gmail.com>\n---\n contrib/completion/git-completion.bash | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex bcda376735c..945d2543b07 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -767,7 +767,7 @@ __git_refs ()\n \t\t\ttrack=\"\"\n \t\t\t;;\n \t\t*)\n-\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD; do\n+\t\t\tfor i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD AUTO_MERGE; do\n \t\t\t\tcase \"$i\" in\n \t\t\t\t$match*|$umatch*)\n \t\t\t\t\tif [ -e \"$dir/$i\" ]; then\n-- \ngitgitgadget\n"},{"id":"477855","messageId":"CABPp-BH+vT_dEKUwn1M2D-FuCtF=hRM8OAFj9m1x6rkV97oEDA@mail.gmail.com","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 0/6] Document 'AUTO_MERGE' and more special refs","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2023-06-01T06:18:22Z","receivedAt":"2023-06-01T06:18:46Z","isPatch":true,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Mon, May 22, 2023 at 12:29 PM Philippe Blain via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n>\n> Thanks everyone for the review!\n>\n> Changes since v1:\n>\n>  * Addressed typos and wording suggestions from Elijah\n>  * Incoporated Eric's wording suggestion\n>  * Added a preliminary patch adressing Victoria's suggestion, based on the\n>    what Taylor sent.\n>\n> This version is not a \"fixups on top\", it's a complete new version. I don't\n> see the point of merging typos to master if we can instead wait for 'next'\n> to be rebuilt after the upcoming release.\n\nI re-read the whole series.  It addresses all the things I brought up\nin v1 (except the bonus idea I threw out there about mentioning how\nAUTO_MERGE is related to --remerge-diff), and all the things I\nremember others bringing up as well.\n\nReviewed-by: Elijah Newren <newren@gmail.com>\n\nThanks for working on this!\n"},{"id":"477858","messageId":"xmqq1qivbpwe.fsf@gitster.g","threadId":"59598","inReplyTo":"pull.1515.v2.git.1684783741.gitgitgadget@gmail.com","subject":"Re: [PATCH v2 0/6] Document 'AUTO_MERGE' and more special refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-01T07:30:41Z","receivedAt":"2023-06-01T07:30:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philippe Blain via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> Thanks everyone for the review!\n>\n> Changes since v1:\n>\n>  * Addressed typos and wording suggestions from Elijah\n>  * Incoporated Eric's wording suggestion\n>  * Added a preliminary patch adressing Victoria's suggestion, based on the\n>    what Taylor sent.\n>\n> This version is not a \"fixups on top\", it's a complete new version. I don't\n> see the point of merging typos to master if we can instead wait for 'next'\n> to be rebuilt after the upcoming release.\n\nOK.  Let's eject what is in 'next' then.\n\n"},{"id":"477859","messageId":"xmqqwn0nab9n.fsf@gitster.g","threadId":"59598","inReplyTo":"CABPp-BH+vT_dEKUwn1M2D-FuCtF=hRM8OAFj9m1x6rkV97oEDA@mail.gmail.com","subject":"Re: [PATCH v2 0/6] Document 'AUTO_MERGE' and more special refs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-06-01T07:32:04Z","receivedAt":"2023-06-01T07:32:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Elijah Newren <newren@gmail.com> writes:\n\n> I re-read the whole series.  It addresses all the things I brought up\n> in v1 (except the bonus idea I threw out there about mentioning how\n> AUTO_MERGE is related to --remerge-diff), and all the things I\n> remember others bringing up as well.\n>\n> Reviewed-by: Elijah Newren <newren@gmail.com>\n>\n> Thanks for working on this!\n\nThanks.\n\nThe previous one I'd discard and replace with this one when opening\nthe tree for the next cycle.\n\n"}]}