git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug report: Folder and files are deleted by git stash -u

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 5, 2015, 19:37 UTC
Message-ID
<xmqqegq4kv44.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqvbjgkw4i.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 19 quoted lines
> Tobias Preuss <tobias.preuss@googlemail.com> writes:
>
>> I noticed some bizarre behaviour when using: git stash -u.
>> It deletes folders which contain files configured to be ignored.
>
> The files you mark as ignored are expendable and this is not limited
> to "stash".
> ...
> Here is what should happen when you go to 'master':
>
>     $ git checkout master
>     Switched to branch 'master'
>     $ /bin/ls -AF
>     a  .git/  .gitignore
>
> That is, a/file.c that is safely stored in 'side' branch is removed,
> a/file.o that is expendable is deleted, and the empty directory 'a'
> now can be replaced with the regular file 'a' the 'master' branch
> wants to have.
Addendum 1.
    If *.o files are not treated expendable, you would be forced to
    "make clean" every time you switch between these two branches,
    which is unacceptable.
Addendum 2.
    There was an old wishlist item to introduce another class of
    paths (in addition to the "tracked", "untracked" and "ignored")
    that are "ignored-but-precious".  Then "*.o" would still be
    expendable while a directory that must become a regular file
    with "ignored-but-precious" files in it would prevent switching
    from branch 'side' to 'master' in the illustration in the
    previous message in order to keep that "ignored-but-precious"
    file.
    But nobody needed such a feature badly enough to step up and
    implement it.
    cf. http://article.gmane.org/gmane.comp.version-control.git/185746
Previous: Junio C Hamano
Message 3 of 3 in “Bug report: Folder and files are deleted by git stash -u”
  1. Tobias PreussFeb 5, 2015
  2. Junio C HamanoFeb 5, 2015
  3. Junio C HamanoFeb 5, 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.