-4

I had new files I had not committed before running git stash thinking they would be saved along with the modified files but they were gone after I returned to the branch and did a stash pop. Are they gone forever?

5
  • 3
    This question is similar to: Is it still possible to restore deleted untracked files in git?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. Commented Nov 19 at 18:32
  • 2
    @Abe git stash by itself doesn't touch untracked files. What was you real command(s) that removed untracked files? git stash -a (or -u) saves untracked files. git stash show -u shows stashed untracked files. See the docs. Commented Nov 19 at 19:22
  • 1
    @phd my command was just git stash without the flag. I was unaware that there were additional flags needed for untracked files, thanks! Commented Nov 20 at 17:42
  • 1
    And to the downvoters, hope it makes you feel better? I was simply asking a question, you could just ignore it . Commented Nov 20 at 17:43
  • @Abe Alas, git stash doesn't have config options to make git stash -u default. It only has a config option for git stash show -u. Commented Nov 20 at 19:32

1 Answer 1

1

Yes, I think it’s gone forever now.

When you use git stash, it saves changes to files that are already being tracked by Git (i.e., files that have been added to the Git repository at some point).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.