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

Re: Revert behavior [Was: Re: [ANNOUNCE] yap: Yet Another (Git) Porcelain]

From
Steven Walter <stevenrwalter@gmail.com>
Date
Sep 9, 2008, 17:29 UTC
Message-ID
<e06498070809091029j1e450c43i276c5a69376da3ab@mail.gmail.com>
In-Reply-To
<5d46db230809090937k44fc569ct7eda35b9ee86cb22@mail.gmail.com>

On Tue, Sep 9, 2008 at 12:37 PM, Govind Salinas <govind@sophiasuchtig.com> wrote:

Show 16 quoted lines
> My take on this comes from my own personal experience with "revert"
> commands, the fact that "how do i undo my working dir changes" is
> the most common question I see on the list and that I have heard
> others with the same complaint.
>
> I will concede that revert usually means both "discard current working
> dir changes" and "undo a previous change" in different circumstances.
> However, the number of times that "how do i discard my working
> dir changes" comes up on the list leads me to believe that you get
> the most out of using revert for this, since it is something that should
> be familiar to a user and undoing a previous commit is more rare.
>
> Of course, this is where I would use a DWIM-ism.
> "pyt revert -r commitish" would generate a reverse patch but
> "pyt revert <paths>..." would checkout from HEAD.  "pyt revert" would
> just "git reset --hard".

In yap, "revert" is used to discard working copy changes. "revert -a" reverts all changes; just "revert" replies "nothing to do." Having "pyt revert" = "git reset --hard" makes me queasy; especially in Dvorak it's all too easy to hit Enter when reaching for '/'; seems like a catastrophe waiting to happen.

I tend to dislike "DWIM" in interfaces, because the computer cannot read your mind, and can therefore never know with certainty what I mean. Especially in cases where the computer thinks I intend to perform an irreversible operation, I want the computer to ask first. Not only that, but I think having one command that does 10 different things is as confusing as 10 commands that each do one thing. My philosophy has been to identify frequent operations and give them sensible commands, rather than overloading a handful of operations or requiring multiple commands for common tasks. My philosophy has also been not to wrap every command. If a user were to ask me, "I want to bisect a changeset," my response would be "okay, use git bisect." If the user wants such a specialized command as that, then they shouldn't have trouble with dealing directly with git for that operation.

-- 
-Steven Walter <stevenrwalter@gmail.com>
"A human being should be able to change a diaper, plan an invasion,
butcher a hog, conn a ship, design a building, write a sonnet, balance
accounts, build a wall, set a bone, comfort the dying, take orders,
give orders, cooperate, act alone, solve equations, analyze a new
problem, pitch manure, program a computer, cook a tasty meal, fight
efficiently, die gallantly. Specialization is for insects."
 -Robert Heinlein
Previous: Govind SalinasNext: Elijah Newren
Message 4 of 13 in “Revert behavior [Was: Re: [ANNOUNCE] yap: Yet Another (Git) Porcelain]”
  1. Elijah NewrenSep 9, 2008
  2. Jakub NarebskiSep 9, 2008
  3. Govind SalinasSep 9, 2008
  4. Steven WalterSep 9, 2008
  5. Elijah NewrenSep 9, 2008
  6. Steven WalterSep 9, 2008
  7. Elijah NewrenSep 9, 2008
  8. Elijah NewrenSep 9, 2008
  9. Petr BaudisSep 9, 2008
  10. Steven WalterSep 9, 2008
  11. Junio C HamanoSep 9, 2008
  12. Steven WalterSep 9, 2008
  13. Elijah NewrenSep 9, 2008

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.