Git Stash: pop on wrong branch committed untracked files to main

Опубликовано: 21 Июль 2026
на канале: TheCodeForge
2
0

`git stash pop` on the wrong branch committed untracked files to main. Root cause: Popped a stash onto the wrong checkout. The fix: Verify branch before pop; `git stash branch` to pop safely.

A production war story from the TheCodeForge Git series — the incident, why it happened, and the exact fix.

⏳ Timestamps:
0:00 - Cold open: CI pipeline failed on main after hotfix merge
0:13 - Intro
0:21 - What Is Git Stash?
0:44 - Core Commands
1:24 - Stash Pop vs Apply
2:09 - Partial Stashing
2:43 - Stash vs Reset
3:23 - Where Stash Lives
3:59 - Best Practices
4:18 - CI pipeline failed on main after hotfix merge
4:44 - Missing -u flag on stash
5:00 - The Fix
5:20 - ⚠ Gotcha: Stashing without -u leaves untracked files
5:38 - ⚠ Gotcha: Stashing without -u leaves untracked files behind
5:53 - ⚠ Gotcha: Using pop when conflicts are possible
6:07 - Stash Entries Are Subject to Garbage Collection
6:40 - Stash Does Not Work with Submodules by Default
6:59 - Debugging Guide
7:19 - Interview Questions
7:50 - FAQ
8:17 - Key Takeaways
8:36 - Next up
8:50 - Wrap-up

👉 Full article + code: https://thecodeforge.io/devops/git-st...
⏭ Next up: Git Cherry Pick: Apply Commits Across Branches

#git #devops #versioncontrol