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

Re: "git stash pop" is doing an unwanted "git add" when there are conflicts.

From
AMAlan Mackenzie <acm@muc.de>
Date
Dec 29, 2015, 21:20 UTC
Message-ID
<20151229212038.GD1884@acm.fritz.box>
In-Reply-To
<20151229075329.GA9254@sigill.intra.peff.net>
Hello, Jeff.
On Tue, Dec 29, 2015 at 02:53:30AM -0500, Jeff King wrote:
> On Thu, Dec 24, 2015 at 09:20:38AM +0000, Alan Mackenzie wrote:
> > > It seems to be a side effect of merge-recursive to stage the results,
> > > and in the no-conflict path we explicitly reset the index. For the
> > > conflicting case, it's trickier, because we would want to retain the
> > > unmerged entries.
> > > So I agree it's kind of weird, but the conflicting case is inherently
> > > going to touch the index, and you'd generally have to `git add` to mark
> > > the resolutions (but if you really want to just touch the working tree,
> > > you'd need to `git reset`).
> > From the point of view of a user, this is suboptimal.  git stash is an
> > abstraction: the preservation of uncomitted changes for later.  Staging
> > previously unstaged changes with git stash pop severely damages this
> > abstraction.
> Yeah, I think I agree. But keep in mind that we have to mention the
> conflicts _somewhere_, so we're going to touch the index regardless (and
> the user is going to have to erase the conflicts in the index
> eventually, either with `git add` or `git reset`).

When the stash consists entirely of changes in the working directory, and "git stash pop" has conflicts, why can't these conflicts simply be marked by "<<<<<<<<" (etc.) in the working directory, leaving the index unchanged? The index is left unchanged when there are no conlicts.

> > Are there any prospects of this getting fixed?
> Somebody needs to write a patch. I am not 100% convinced that it
> _should_ be fixed, but I am leaning that way. But I am not planning to
> work on it myself anytime soon. The best way to get more discussion
> going is to post a patch. :)
Hmm.  I would very much prefer to remain just a user of git.
> -Peff
-- 
Alan Mackenzie (Nuremberg, Germany).
Previous: Jeff KingNext: Jeff King
Message 9 of 10 in “"git stash pop" is doing an unwanted "git add" when there are conflicts.”
  1. Alan MackenzieDec 21, 2015
  2. Alan MackenzieDec 21, 2015
  3. Dennis KaarsemakerDec 22, 2015
  4. Jeff KingDec 22, 2015
  5. Alan MackenzieDec 24, 2015
  6. Jeff KingDec 29, 2015
  7. Junio C HamanoDec 29, 2015
  8. Jeff KingDec 30, 2015
  9. Alan MackenzieDec 29, 2015
  10. Jeff KingDec 30, 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.