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
Dennis Kaarsemaker <dennis@kaarsemaker.net>
Date
Dec 22, 2015, 08:17 UTC
Message-ID
<1450772258.7937.9.camel@kaarsemaker.net>
In-Reply-To
<20151221142953.GA12764@acm.fritz.box>
On ma, 2015-12-21 at 14:29 +0000, Alan Mackenzie wrote:
Show 13 quoted lines
> Hello, git project.
> 
> Last night, whilst clearing out a stale "stash stack", I did "git stash
> pop".  There were conflicts in two files.
> 
> However, all the popped files became staged.  This doesn't normally happen.
> It was intensely irritating, and required me to do "git reset HEAD" on
> each of the files, none of which I wanted to commit.
> 
> I searched the git-stash man page for this scenario, but found nothing
> about it.
> 
> Surely staging all the files is a bug?

That depends. A stash is two commits: one for all changes that were in the index when you ran 'git stash save' and one for all changes not yet in the index. When you pop the stash, these then get restored as staged resp. unstaged changes. So if your changes are now all staged, I'd wager that they were staged when you ran git stash save.

-- 
Dennis Kaarsemaker
www.kaarsemaker.net
Previous: Alan MackenzieNext: Jeff King
Message 3 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.