git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Documentation clarification on git-checkout regarding ours/theirs

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 11, 2015, 15:37 UTC
Message-ID
<xmqqwpzafe88.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1434022766-45397-1-git-send-email-simon.eu@gmail.com>
"Simon A. Eugster" <simon.eu@gmail.com> writes:
Show 21 quoted lines
> From: "Simon A. Eugster" <simon.eugster@eps.ch>
>
> Signed-off-by: Simon A. Eugster <simon.eugster@eps.ch>
> ---
>  Documentation/git-checkout.txt | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
> index d263a56..5c3ef86 100644
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -115,7 +115,11 @@ entries; instead, unmerged entries are ignored.
>  --ours::
>  --theirs::
>  	When checking out paths from the index, check out stage #2
> -	('ours') or #3 ('theirs') for unmerged paths.
> +	('ours', HEAD) or #3 ('theirs', MERGE_HEAD) for unmerged paths.
> ++
> +After a `git pull --rebase`, for example, 'ours' points to the remote
> +version and 'theirs' points to the local version. See linkgit:git-merge[1]
> +for details about stages #2 and #3.

I think it is a good idea to mention that it takes a switching of viewpoint [*1*] when reading ours/theirs during "git rebase" (and by extension "git pull --rebase").

But I am afraid that it may be detrimental to say 'for example' and mentioning _only that_ for two reasons:

 - it does not make it clear what is said in that paragraph is an
   exception, which would mislead those who are doing "git pull"
   without rebase (for them, --ours is their own work, --theirs is
   what they are pulling from outside).
 - it does not make it clear that the paragraph is giving a
   warning---many people who think they know what they are doing
   would stop reading carefully after seeing 'for example', so those
   who do use 'rebase' (either 'git rebase' or 'git pull --rebase')
   would miss the subtlety.

Perhaps rephrasing it to make it clear that this describes a warning about an exception may be needed? Starting the paragraph like so, perhaps:

    Note that during `git rebase` and `git pull -rebase`, 'ours' and
    'theirs' may appear to be swapped (i.e. 'ours' is the history
    from the remote or the history onto which you are rebasing, and
    'theirs' is the history of your private work).  This is for such
    and such reasons...
[Footnote]

*1* The reason why ours/theirs appear to be swapped during a rebase is because you are temporarily assuming the role of the keeper of the canonical history while doing so. A rebase is to treat the history that came from the remote as the canonical one, and then treat what you did as the "third party" work that need to be integrated into the canonical history. That makes what you obtained from the remote "ours" (i.e. the shared history of our project we collectively own) and yoru work "theirs" (i.e. other people's work to be integrated into "our" shared history, but you happen to be that "other people" in this case).

Previous: Simon A. EugsterNext: Simon A. Eugster
Message 2 of 10 in “Documentation clarification on git-checkout regarding ours/theirs”
  1. Documentation clarification on git-checkout regarding ours/theirsSimon A. Eugster, Jun 11, 2015
  2. Junio C HamanoJun 11, 2015
  3. Documentation clarification on git-checkoutSimon A. Eugster, Jun 15, 2015
  4. 1/2 Documentation clarification on git-checkout regarding ours/theirsSimon A. Eugster, Jun 15, 2015
  5. 2/2 Documentation on git-checkout --ours/--theirs improvedSimon A. Eugster, Jun 15, 2015
  6. Junio C HamanoJun 15, 2015
  7. Simon EugsterJun 16, 2015
  8. Junio C HamanoJun 16, 2015
  9. Simon EugsterJun 17, 2015
  10. Junio C HamanoJun 17, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.