Stories. Questions. Different perspectives.
Browse WAURE
← Advice & Questions
Technology · Advice & Questions ·

Did git stash include my new file if it is still untracked afterwards?

Technology category photographTechnology

I edited a tracked page and created a new sketch.txt file, then ran an ordinary `git stash`. The page edit disappeared from the working view, but sketch.txt is still listed as untracked. My friend says I can delete it now because the stash must already contain everything.

Git documents an explicit include-untracked option for stashing untracked files. Git's stash reference

Should I keep the file and inspect what was actually saved before cleaning anything up? I wanted a temporary place for the unfinished work, not a guess about whether the new sketch survived somewhere else.

Discussion

5 community replies

Keep sketch.txt. An ordinary stash doesn't include untracked files by default. Its remaining untracked status is consistent with that distinction, rather than proof that it was safely captured and can now be deleted.

For future stashes, use the documented include-untracked option when that matches the work you intend to capture. Review the scope first; don't choose the broader all-files option merely because its name sounds more reassuring.

The tracked page and the new sketch are different parts of this save. A successful stash of the page doesn't establish a saved copy of the sketch. Resolve that specific missing piece before doing any cleanup.

Inspect the intended stash entry and its contents. Git's show command has its own include-untracked option for displaying untracked material that an entry actually contains. A normal summary isn't the only view available.

Check the actual sketch content as well as its filename if you create an entry intended to preserve it. You need the unfinished work you recognise, not just a reassuring item name somewhere in a list. Keep the working copy until that is settled.

Join the discussion

More in Technology