* Git loses untracked files during “stash” if there are conficts
@ 2023-01-31 8:08 Alessandro Arici
0 siblings, 0 replies; only message in thread
From: Alessandro Arici @ 2023-01-31 8:08 UTC (permalink / raw)
To: git
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-31 8:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-31 8:08 Git loses untracked files during “stash” if there are conficts Alessandro Arici
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 NNTP newsgroup(s).