From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why? Date: Sun, 20 Dec 2015 23:04:32 +0000 Message-ID: <20151220230432.GC26401@acm.fritz.box> References: <20151220220127.GB26401@acm.fritz.box> <877fk8ka8a.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1450652575 16061 80.91.229.3 (20 Dec 2015 23:02:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Dec 2015 23:02:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Kastrup Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Dec 21 00:02:46 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aAn02-0006yS-CF for ged-emacs-devel@m.gmane.org; Mon, 21 Dec 2015 00:02:46 +0100 Original-Received: from localhost ([::1]:42322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAn01-0006Is-Ht for ged-emacs-devel@m.gmane.org; Sun, 20 Dec 2015 18:02:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAmzh-0006GG-Fp for emacs-devel@gnu.org; Sun, 20 Dec 2015 18:02:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aAmzd-0002s7-H2 for emacs-devel@gnu.org; Sun, 20 Dec 2015 18:02:25 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:29527) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aAmzd-0002rl-8v for emacs-devel@gnu.org; Sun, 20 Dec 2015 18:02:21 -0500 Original-Received: (qmail 37507 invoked by uid 3782); 20 Dec 2015 23:02:18 -0000 Original-Received: from acm.muc.de (p579E9076.dip0.t-ipconnect.de [87.158.144.118]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 21 Dec 2015 00:02:17 +0100 Original-Received: (qmail 1449 invoked by uid 1000); 20 Dec 2015 23:04:32 -0000 Content-Disposition: inline In-Reply-To: <877fk8ka8a.fsf@fencepost.gnu.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196578 Archived-At: Hello, David. On Sun, Dec 20, 2015 at 11:48:21PM +0100, David Kastrup wrote: > Alan Mackenzie 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).