all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Git help requested: "git stash pop" is doing an unwanted "git add". Why?
@ 2015-12-20 22:01 Alan Mackenzie
  2015-12-20 22:48 ` David Kastrup
  2015-12-21  3:35 ` Eli Zaretskii
  0 siblings, 2 replies; 7+ messages in thread
From: Alan Mackenzie @ 2015-12-20 22:01 UTC (permalink / raw)
  To: emacs-devel

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?

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-20 22:01 Git help requested: "git stash pop" is doing an unwanted "git add". Why? Alan Mackenzie
@ 2015-12-20 22:48 ` David Kastrup
  2015-12-20 23:04   ` Alan Mackenzie
  2015-12-21  3:35 ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: David Kastrup @ 2015-12-20 22:48 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Alan Mackenzie <acm@muc.de> 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.  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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-20 22:48 ` David Kastrup
@ 2015-12-20 23:04   ` Alan Mackenzie
  0 siblings, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2015-12-20 23:04 UTC (permalink / raw)
  To: David Kastrup; +Cc: emacs-devel

Hello, David.

On Sun, Dec 20, 2015 at 11:48:21PM +0100, David Kastrup wrote:
> Alan Mackenzie <acm@muc.de> 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).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-20 22:01 Git help requested: "git stash pop" is doing an unwanted "git add". Why? Alan Mackenzie
  2015-12-20 22:48 ` David Kastrup
@ 2015-12-21  3:35 ` Eli Zaretskii
  2015-12-21 20:26   ` Alan Mackenzie
  1 sibling, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-12-21  3:35 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

> Date: Sun, 20 Dec 2015 22:01:28 +0000
> From: Alan Mackenzie <acm@muc.de>
> 
> 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?

It's "git stash pop", yes.  You need to "git reset" after "stash pop",
if you want to be sure the changes are not staged (a.k.a. "in the
index").



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-21  3:35 ` Eli Zaretskii
@ 2015-12-21 20:26   ` Alan Mackenzie
  2015-12-22 15:35     ` Mike Gerwitz
  0 siblings, 1 reply; 7+ messages in thread
From: Alan Mackenzie @ 2015-12-21 20:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Hello, Eli.

On Mon, Dec 21, 2015 at 05:35:06AM +0200, Eli Zaretskii wrote:
> > Date: Sun, 20 Dec 2015 22:01:28 +0000
> > From: Alan Mackenzie <acm@muc.de>

> > 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?

> It's "git stash pop", yes.  You need to "git reset" after "stash pop",
> if you want to be sure the changes are not staged (a.k.a. "in the
> index").

It looks like it.  I've dropped a note to the git mailing list,
suggesting that this is a bug.  We'll see if anything comes of that.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-21 20:26   ` Alan Mackenzie
@ 2015-12-22 15:35     ` Mike Gerwitz
  2015-12-22 16:11       ` Renaud Casenave-Péré
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Gerwitz @ 2015-12-22 15:35 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Eli Zaretskii, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 466 bytes --]

On Mon, Dec 21, 2015 at 20:26:21 +0000, Alan Mackenzie wrote:
> It looks like it.  I've dropped a note to the git mailing list,
> suggesting that this is a bug.  We'll see if anything comes of that.

See git-stash(1):
         Use git stash when you want to record the current state of the
         working directory and the index

-- 
Mike Gerwitz
Free Software Hacker | GNU Maintainer
https://mikegerwitz.com
FSF Member #5804 | GPG Key ID: 0x8EE30EAB

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Git help requested: "git stash pop" is doing an unwanted "git add". Why?
  2015-12-22 15:35     ` Mike Gerwitz
@ 2015-12-22 16:11       ` Renaud Casenave-Péré
  0 siblings, 0 replies; 7+ messages in thread
From: Renaud Casenave-Péré @ 2015-12-22 16:11 UTC (permalink / raw)
  To: Mike Gerwitz; +Cc: Alan Mackenzie, Eli Zaretskii, emacs-devel

In my experience, if some files are in conflict, git will add to index all
non-conflicting files to clearly separate the conflicting ones.
You are then expected to resolve the conflicts, stage the files to tell git to
accept the resolved files, and do a git reset to put everything back in the
working area.

I think this is something that is not (properly) documented and quite confusing
but when you know what to do, you get used to it…

-- 
Renaud Casenave-Péré



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-12-22 16:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-20 22:01 Git help requested: "git stash pop" is doing an unwanted "git add". Why? Alan Mackenzie
2015-12-20 22:48 ` David Kastrup
2015-12-20 23:04   ` Alan Mackenzie
2015-12-21  3:35 ` Eli Zaretskii
2015-12-21 20:26   ` Alan Mackenzie
2015-12-22 15:35     ` Mike Gerwitz
2015-12-22 16:11       ` Renaud Casenave-Péré

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.