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

Re: Reset by checkout?

From
Kevin Bracey <kevin@bracey.fi>
Date
Jun 3, 2014, 19:48 UTC
Message-ID
<538E26A1.5020509@bracey.fi>
In-Reply-To
<xmqqmwdv2d08.fsf@gitster.dls.corp.google.com>
On 03/06/2014 00:54, Junio C Hamano wrote:
Show 11 quoted lines
>
> Not that I can think of a better way to update these descriptions,
> and not that I am opposing to update these descriptions to make it
> easier for new people to learn, but I am not sure if these "treat
> ORIG_HEAD and the changes since that commit as separate entities"
> is a good approach to do so.
>
> Somewhat frustrated, not by your patch but by being unable to
> suggest a better way X-<.
>
>

I know. I started off myself knowing what I meant to say, and then got bogged down somewhat trying to be detailed enough for a full explanation. I think it's just inherently very hard for anyone to visualise what these do in the /general/ case.

This is one of those commands where the structure of a man page gets in the way. We have to give a summary of what the mode options /do/, but that's not what people want to know. They want to know what they're /for/.

(And, to some extent, reset, like checkout, is two separate commands. One being the path manipulator, the other being the HEAD manipulator. Just bogs us down further).

I think these are the most important HEAD resets, covering 95%+ of uses:
    git reset --soft HEAD~<n>
    git reset HEAD~<n>
    git reset --keep HEAD~<n>
    git reset --keep ORIG_HEAD
    git reset --keep @{<n>}
    git reset --keep <some other arbitary place>
(and possibly
    git reset --merge

although I think this should be fully covered by "git xxx --abort" - maybe a couple of those missing like git stash pop/apply --abort?)

Anything more than those, I think, are pretty far-fetched. I can't 100% grok "--soft/--mixed" onto a different branch, for example. (But at least we do define those cases in the A/B/C/D "discussion" section for the real geeks.)

Maybe we just need to tighten up the EXAMPLES section? Give it easy-to-locate <path>/--soft/--mixed/--keep subheadings, covering all those common use cases (in clean trees...), including a before/after git status views. Then normal users could skip the top technical section waffling about indexes and go straight there instead.

Kevin
Previous: Junio C HamanoNext: Felipe Contreras
Message 8 of 18 in “Reset by checkout?”
  1. Atsushi NakagawaMay 31, 2014
  2. Andreas SchwabMay 31, 2014
  3. Atsushi NakagawaJun 1, 2014
  4. Kevin BraceyMay 31, 2014
  5. Atsushi NakagawaJun 1, 2014
  6. Kevin BraceyJun 1, 2014
  7. Junio C HamanoJun 2, 2014
  8. Kevin BraceyJun 3, 2014
  9. Felipe ContrerasJun 3, 2014
  10. Atsushi NakagawaJun 7, 2014
  11. Philip OakleyJun 7, 2014
  12. Kevin BraceyJun 9, 2014
  13. Atsushi NakagawaJun 7, 2014
  14. Felipe ContrerasMay 31, 2014
  15. Felipe ContrerasMay 31, 2014
  16. Atsushi NakagawaJun 1, 2014
  17. Junio C HamanoJun 2, 2014
  18. Junio C HamanoJun 2, 2014

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.