git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Julia Evans" <julia@jvns.ca>
Cc: "Julia Evans" <gitgitgadget@gmail.com>,  git@vger.kernel.org
Subject: Re: [PATCH 2/5] doc: git-add: start man page with an example
Date: Thu, 14 Aug 2025 22:38:45 -0700	[thread overview]
Message-ID: <xmqqy0rlta8q.fsf@gitster.g> (raw)
In-Reply-To: <e1c9f388-f72c-4bb4-b05d-b5b183501456@app.fastmail.com> (Julia Evans's message of "Wed, 13 Aug 2025 22:59:18 -0400")

"Julia Evans" <julia@jvns.ca> writes:

> This example makes me think that if we want people to understand the
> limitations of the index, it's important to communicate that the past
> index snapshots are *discarded* and not just that the index is a snapshot.

I suspect that you need to look at the whole thing backwards.  I
realize that it is another way to say that you are looking at the
whole thing backwards, so take your pick ;-).

Nobody stops you from extending the system to store more than one
snapshots in the index and allow your users to roll back to one of
these snapshots kept in the index.  The reason why we haven't done
so is because there has not been motivating any use case for such a
feature (and coming up with a reasonable UI for it would also be
more work).  After all, if you want to keep a set of good points to
go back to [*], that is what commits are for in the world view of
Git, where creating commits and moving around in history are cheap.
If it were something worth going back to, you'd do so at the commit
level.  "git stash" and its index operations (like the "--keep"
option that allows you to test with only what is in the index) are
implemented as (temporary) commits internally exactly for this
reason.

Having said that, there is a focused support to record the previous
state before a snapshot records a resolution for a conflicted path
[**].  This was added because of a concrete motivating use case to
allow you to recover from a botched conflict resolution (aka "gee, I
thought this resolution was OK but I did 'git add' way too early,
before I actually tested the result!"), where "you can commit to
mark the place to later go back" principle does not cleanly apply,
since commits in Git do not record conflicted state.

Please don't keep asking "why" on this point (i.e. "why not record
conflicts in commit?") and other things---at some point, the answers
will become a series of "that is how it is, and it has been good
enough for us", and then it becomes a waste of time to further ask
"why".  Until "here is the change I made to do things differently;
please see how well it works" materializes, that is.


[Footnote]

 * This is another example why the snapshot worldview gives clear
   workflow.  After you pile on several drunken-walk experimental
   commits on top of a good commit and realize that this particular
   line of effort is leading nowhere, you "jump back" to that known
   good point (i.e. "git reset --hard HEAD~7").  You do not have to
   apply these changes in reverse direction (i.e. "git apply -R") in
   reverse order (i.e. "git rev-list --reverse HEAD~7..".

** Read about "Resolve undo" in the documentation.

  reply	other threads:[~2025-08-15  5:38 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 20:07 [PATCH 0/5] doc: git-add: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-12 20:07 ` [PATCH 1/5] doc: git-add: remove options from SYNOPSIS Julia Evans via GitGitGadget
2025-08-12 20:41   ` Junio C Hamano
2025-08-13 16:58     ` Julia Evans
2025-08-13 20:47   ` Jean-Noël AVILA
2025-08-12 20:07 ` [PATCH 2/5] doc: git-add: start man page with an example Julia Evans via GitGitGadget
2025-08-12 21:01   ` Junio C Hamano
2025-08-12 21:40     ` Julia Evans
2025-08-12 22:12       ` Junio C Hamano
2025-08-12 22:45         ` Julia Evans
2025-08-13 17:22       ` D. Ben Knoble
2025-08-14  0:41       ` Junio C Hamano
2025-08-14  2:59         ` Julia Evans
2025-08-15  5:38           ` Junio C Hamano [this message]
2025-08-12 20:07 ` [PATCH 3/5] doc: git-add: simplify discussion of ignored files Julia Evans via GitGitGadget
2025-08-13 17:24   ` D. Ben Knoble
2025-08-12 20:07 ` [PATCH 4/5] doc: git-add: make explanation less dry Julia Evans via GitGitGadget
2025-08-12 20:07 ` [PATCH 5/5] doc: git-add: explain inconsistent terminology Julia Evans via GitGitGadget
2025-08-12 20:51   ` Chris Torek
2025-08-12 21:36     ` Junio C Hamano
2025-08-12 21:43       ` Julia Evans
2025-08-13 23:20 ` [PATCH v2 0/4] doc: git-add: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-13 23:20   ` [PATCH v2 1/4] doc: git-add: start man page with an example Julia Evans via GitGitGadget
2025-08-15  0:38     ` Junio C Hamano
2025-08-15 13:34       ` Jean-Noël AVILA
2025-08-15 16:33         ` Junio C Hamano
2025-08-17 18:37           ` Jean-Noël AVILA
2025-08-19 20:01             ` Julia Evans
2025-08-13 23:20   ` [PATCH v2 2/4] doc: git-add: simplify discussion of ignored files Julia Evans via GitGitGadget
2025-08-14  0:59     ` D. Ben Knoble
2025-08-14 22:10     ` Junio C Hamano
2025-08-13 23:20   ` [PATCH v2 3/4] doc: git-add: make explanation less dry Julia Evans via GitGitGadget
2025-08-14 22:22     ` Junio C Hamano
2025-08-15 16:10       ` Julia Evans
2025-08-15 18:25         ` D. Ben Knoble
2025-08-15 20:01           ` Junio C Hamano
2025-08-16 14:15             ` D. Ben Knoble
2025-08-15 19:47         ` Junio C Hamano
2025-08-19 12:57           ` Julia Evans
2025-08-21 20:36             ` Jean-Noël AVILA
2025-08-13 23:20   ` [PATCH v2 4/4] doc: git-add: explain inconsistent terminology Julia Evans via GitGitGadget
2025-08-14 22:49     ` Junio C Hamano
2025-08-19 20:09       ` Julia Evans
2025-08-19 20:46   ` [PATCH v3 0/3] doc: git-add: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-19 20:46     ` [PATCH v3 1/3] Git 2.51 Junio C Hamano via GitGitGadget
2025-08-19 21:06       ` rsbecker
2025-08-19 21:37         ` Junio C Hamano
2025-08-19 21:44           ` D. Ben Knoble
2025-08-19 21:48             ` Julia Evans
2025-08-19 21:49           ` rsbecker
2025-08-19 20:46     ` [PATCH v3 2/3] doc: git-add: clarify intro & add an example Julia Evans via GitGitGadget
2025-08-21 20:08       ` Junio C Hamano
2025-08-22 20:37         ` Julia Evans
2025-08-19 20:46     ` [PATCH v3 3/3] doc: git-add: simplify discussion of ignored files Julia Evans via GitGitGadget
2025-08-21 20:09       ` Junio C Hamano
2025-08-29 11:55     ` [PATCH v4 0/2] doc: git-add: clarify DESCRIPTION section Julia Evans via GitGitGadget
2025-08-29 11:55       ` [PATCH v4 1/2] doc: git-add: clarify intro & add an example Julia Evans via GitGitGadget
2025-08-29 11:55       ` [PATCH v4 2/2] doc: git-add: simplify discussion of ignored files Julia Evans via GitGitGadget
2025-08-29 17:11       ` [PATCH v4 0/2] doc: git-add: clarify DESCRIPTION section Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy0rlta8q.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=julia@jvns.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).