Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What are the risks of relying on git stash?

SHORT ANSWER

Stashes are local, easy to forget, and git stash drop or clear removes them. They are not on GitHub, so a disk failure loses them. For anything you care about, commit on a temporary branch instead.

Explain it simply

A stash is a drawer in your own room, not in the shared office. Nobody else can see it and it is easy to forget what is in there.

Problems appear after a month: five unnamed stashes, none of which you remember, some conflicting with new code. They are never pushed, so deleting the local repo deletes them too. A short-lived wip branch or commit is usually safer, since it appears in history and can be pushed as a backup. Use stash for minutes or hours, not weeks. If you drop one by mistake, git fsck --unreachable may still find it.

Example

bash
# safer alternative for longer pauses
git switch -c wip/navbar
git commit -am "WIP navbar"
git push -u origin wip/navbar

What to say in the interview

"Stash is local, unnamed by default and easy to lose, so I use it only for short interruptions. For longer pauses I commit to a work-in-progress branch and push it as a backup."

#git#stash#best-practice

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.