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

Git loses untracked files during “stash” if there are conficts

From
AAAlessandro Arici <alessandro.arici@gmail.com>
Date
Jan 31, 2023, 08:08 UTC
Message-ID
<CAMvf6PPcKQYLWbj1x8P0Y=8rG19i8DNNPG=fCBUvaHLCRKXDmg@mail.gmail.com>

Using git stash -u, but, as title, when there are conflicts untracked files are gone.

This is a link, for example: https://www.databasesandlife.com/git-stash-loses-untracked-files/

And this is a reproduction of the bug

# Create a Git repo with a single file committed git init echo contents > original-file.txt git add original-file.txt git commit -m "Creating the file"

# Create a new file, modify an old one, stash echo foo > new-file.txt echo contents2 > original-file.txt git stash push -u

# Modify the old file in a different way, commit echo contents3 > original-file.txt git commit -am "Altering the file"

# Apply the stash, see conflict, but what about the new file? git stash pop cat new-file.txt

Git version, on Linux: 2.34.1
Thank you
Message 1 of 1 in “Git loses untracked files during “stash” if there are conficts”
  1. Alessandro AriciJan 31, 2023

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.