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

Re: [PATCH v3 3/4] reset: add option "--merge-safe" to "git reset"

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Sep 17, 2009, 13:05 UTC
Message-ID
<4AB23410.6080508@viscovery.net>
In-Reply-To
<c07716ae0909170512k3c2ec7m21e69e9acfdfd81f@mail.gmail.com>
Christian Couder schrieb:
Show 15 quoted lines
> On Thu, Sep 17, 2009 at 9:24 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:
>> Junio C Hamano schrieb:
>>> Johannes Sixt <j.sixt@viscovery.net> writes:
>>  $ git stash
>>  $ git reset --hard $target
>>  $ git stash pop
>>
>>> I have _no_ idea what the intended use-case of --merge-safe is, and that
>>> was why I asked Christian for clarification in the previous round.  The
>>> answer was still not clear enough so I pointed out --merge-safe could be
>>> still doing a wrong thing even in _his_ use-case.
>> Reading Christian in 200909170554.49416.chriscool@tuxfamily.org, I think
>> this *is* his use-case? Christian?
> 
> Yes, I agree, it can be used instead of git stash.

It "can"? Do you say that you intend --merge-safe for something else in addition to the above stash + reset --hard + stash pop sequence? What?

> By the way Linus, in his
> patch that added the --merge option, said that --merge could be used like
> that.

But that use-case has one important difference: You can't use stash right before the reset:

   # work tree is dirty
   $ git pull $there $topic  # assume we have conflicts
   # investigate result ...
   # oh no, that's crap, scratch it
   $ git stash what? conflicted changes?
   $ git reset what? --hard would remove my dirty state, too
You are screwed. 'git reset --merge' comes to rescue.

I'm pretty sure you don't mean --merge-safe to provide extra safety in *this* use-case, but that you have a very different use-case in mind.

-- Hannes
Previous: Christian CouderNext: Christian Couder
Message 10 of 15 in “"git reset --merge" related improvements”
  1. 0/4 "git reset --merge" related improvementsChristian Couder, Sep 17, 2009
  2. 1/4 reset: add a few tests for "git reset --merge"Christian Couder, Sep 17, 2009
  3. 2/4 reset: use "unpack_trees()" directly instead of "git read-tree"Christian Couder, Sep 17, 2009
  4. 3/4 reset: add option "--merge-safe" to "git reset"Christian Couder, Sep 17, 2009
  5. Junio C HamanoSep 17, 2009
  6. Johannes SixtSep 17, 2009
  7. Junio C HamanoSep 17, 2009
  8. Johannes SixtSep 17, 2009
  9. Christian CouderSep 17, 2009
  10. Johannes SixtSep 17, 2009
  11. Christian CouderSep 17, 2009
  12. Junio C HamanoSep 17, 2009
  13. Christian CouderSep 17, 2009
  14. Daniel BarkalowSep 17, 2009
  15. 4/4 reset: add test cases for "--merge-safe" optionChristian Couder, Sep 17, 2009

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.