git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin Locke <kevin@kevinlocke.name>
To: git@vger.kernel.org
Cc: Michael Brade <brade@kde.org>
Subject: Re: git stash save -u deletes ignored files without stashing them
Date: Wed, 3 Feb 2016 23:40:11 -0800	[thread overview]
Message-ID: <20160204074011.GA25382@kevinolos> (raw)
In-Reply-To: <566D236D.5090904@kde.org>

On Sun, 2015-12-13 at 7:51, Michael Brade wrote:
> Now node_modules will be deleted even though it was ignored at the time
> of the "git stash save -u". Apparently .gitignore is reverted first,
> then the cleanup is done taking the new state of .gitignore into account
> where node_modules is now untracked and not ignored anymore, thus
> deleting it.

Another effect of this, although obviously less severe, is that it can
create a stash which can not be applied without additional work:

git init
echo test.txt > .gitignore
git add .gitignore
git commit -m init
echo stuff > test.txt
echo > .gitignore
git stash -u

At this point the stash contains test.txt (untracked) and the changes
to .gitignore which unignore the file, but test.txt is also left in
the working directory.  Attempting to apply the stash produces the
following result:

$ git stash apply
test.txt already exists, no checkout
Could not restore untracked files from stash

So the user must remove it themselves, which can be confusing since
the file is not listed in `git stash show`, which doesn't include
untracked files.

Kevin

P.S.  Please CC me on replies.  Thanks!

      reply	other threads:[~2016-02-04  7:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-13  7:51 git stash save -u deletes ignored files without stashing them Michael Brade
2016-02-04  7:40 ` Kevin Locke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160204074011.GA25382@kevinolos \
    --to=kevin@kevinlocke.name \
    --cc=brade@kde.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).