[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Git help requested: "git stash pop" is doing an unwanted "git add".
From: |
Alan Mackenzie |
Subject: |
Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why? |
Date: |
Sun, 20 Dec 2015 23:04:32 +0000 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
Hello, David.
On Sun, Dec 20, 2015 at 11:48:21PM +0100, David Kastrup wrote:
> Alan Mackenzie <address@hidden> writes:
> > Hello, Emacs.
> > I'm clearing out a "stash stack" in my master repository copy. I've
> > just done "git stash pop", expecting git to pop the changes into my
> > working directory.
> > Well, there were 2 files with conflicts - fair enough. But with all the
> > other files, git has had the cheek to do a "git add" (I think the jargon
> > for this is "moved the files to the staging area"), leaving me with the
> > hassle of doing a "git reset" on quite a lot of files.
> > Why has the "git stash pop" done this, and how can I call "git stash
> > pop" in the future, avoiding this annoying problem?
> git stash saves both work directory changes as well as already staged
> files. git stash pop restores both. So you likely git-added some files
> before stashing.
I doubt that very much. I've only ever git-added files immediately prior
to committing. But I suppose it's possible something in git had staged
my files without me really noticing, before doing the git stash.
> Personally, I prefer to create commits (that I'll amend afterwards) to
> stashes once I progressed far enough to actually add stuff to the
> index.
> --
> David Kastrup
--
Alan Mackenzie (Nuremberg, Germany).