I hope you've found this thread helpful and learnt something new.
If you did:
β
Follow me @sumitsaurabh927 for more.
β
Like and comment down below
β
Repost the quote below:
@sumit.bsky.social
Full Stack Dev | π₯ Developer Advocate π | Public Speaker π€ | Talks about Javascript, React, Open Source and web dev
I hope you've found this thread helpful and learnt something new.
If you did:
β
Follow me @sumitsaurabh927 for more.
β
Like and comment down below
β
Repost the quote below:
Join a community of early-age developers and level up:
discord.gg/pjTvDtE2
π Final Takeaway: Use Git Stash Wisely
βοΈ Great for quick, temporary saves
β Not a replacement for commits
π‘ When in doubt, create a branch instead
9οΈβ£ Bonus: Recovering a Dropped Stash π±
Accidentally dropped a stash? You might still recover it:
Try: git fsck --lost-found and look for stash-like commits.
8οΈβ£ Managing & Cleaning Up Stashes
π Clear all stashes: git stash clear
π Delete a specific stash: git stash drop stash@{1}
Pro tip: If you use stashes often, clean them up regularly!
7οΈβ£ Better Alternatives to git stash
π Use WIP commits: git commit -m "WIP"
π Create a temporary branch
π Use git worktree for parallel work
6οΈβ£ When You Shouldnβt Use git stash β
π¨ If your work is important (stashes arenβt safe long-term)
π¨ If you switch tasks often (easy to forget stashes)
π¨ If you need team visibility (stashes are local, not shared)
5οΈβ£ When You Should Use git stash β
βοΈ Switching branches temporarily
βοΈ Need a clean working directory for testing
βοΈ Quickly save work without committing
4οΈβ£ Applying a Specific Stash
If you have multiple stashes, apply a specific one using:
git stash apply stash@{2}
This applies the 3rd stash in your history (zero-based index).
3οΈβ£ Keep Track of Stashes with Messages
By default, stashes are unnamed, which can get messy. Instead, use:
π git stash push -m "WIP: Fixing login bug"
π View stash history: git stash list
2οΈβ£ The Basics: Stashing and Applying
π Stash changes: git stash
β»οΈ Apply latest stash: git stash pop (removes it from stash history)
π Apply without removing: git stash apply
1οΈβ£ What Is git stash?
πΉ Temporarily saves uncommitted changes
πΉ Cleans your working directory
πΉ Lets you switch branches without committing
πΉ Think of it as a clipboard for your code
The Right Way to Use Git Stash (And When You Shouldnβt) π©π
Ever needed to switch branches but didnβt want to commit half-done work?
'git stash' to the rescue!
But misusing it can cause headaches.
Hereβs how to use it correctly (and when to avoid it) π
I hope you've found this thread helpful and learnt something new.
If you did:
β
Follow me @sumitsaurabh927 for more.
β
Like and comment down below
β
Repost the quote below:
Don't forget to checkout our completely free tool 'av' cooked in the kitchens of @Aviator_co_ π
It helps you create and manage stacked PRs completely free.
π: github.com/aviator-co/av
7οΈβ£ Bonus: Stacked PRs Work Best With Feature Flags π©
πΉ Ship incomplete features behind flags
πΉ Merge incrementally without affecting users
πΉ Reduce risk of breaking production
6οΈβ£ Merge Strategy: Bottom-Up vs. Top-Down
πΉ Bottom-up: Merge base PR first, then the next
πΉ Top-down: Rebase from the base PR as you go
Tools like gh stack & av make this effortless!
5οΈβ£ Example: Adding a Dark Mode Feature π
β One Big PR β Backend, API, UI, styles, settings all in one = π₯
β
Stacked PRs:
1οΈβ£ Backend: Store dark mode preference
2οΈβ£ API: Expose preference
3οΈβ£ UI: Toggle switch + styles
Much easier to review!
4οΈβ£ Developers Benefit Too π
πΉ Less waiting for approvals
πΉ Merge work incrementally instead of all at once
πΉ Avoid rewriting code due to delayed feedback
πΉ Keep main branch stable while shipping fast
3οΈβ£ Reviewers Love Stacked PRs β€οΈ
β
Faster reviews (small changes = quick feedback)
β
Focused discussions (each PR solves one problem)
β
Fewer merge conflicts (less code churn)
β
Easier debugging (pinpoint issues in smaller PRs)
2οΈβ£ What Are Stacked PRs?
πΉ A sequence of smaller, dependent PRs
πΉ Each PR builds on the previous one
πΉ Easier to review since each PR focuses on a single step
Example:
β
PR 1: Refactor DB schema
β
PR 2: API changes
β
PR 3: Update UI
1οΈβ£ Big PRs = Big Problems
β Hard to review
β Reviewers get lost in too many changes
β Endless back & forth slows progress
β Rubber-stamping leads to hidden bugs
Stacked PRs fix this π
Why Stacked PRs Make Collaboration Easier π
PR reviews shouldn't feel like a battle.
Stacked PRs break big changes into smaller, reviewable pieces, making teamwork seamless.
Hereβs why they supercharge collaboration π
I hope you've found this thread helpful and learnt something new.
If you did:
β
Follow me @sumitsaurabh927 for more.
β
Like and comment down below
β
Repost the quote below:
Don't forget to checkout our completely free tool 'av' cooked in the kitchens of @Aviator_co_ π
It helps you create and manage stacked PRs completely free.
π: github.com/aviator-co/av
7οΈβ£ Stacked PRs + CI/CD = Speed & Safety
π Deploy changes incrementally
π Rollback only the problematic PR
π CI tests each PR individually
This is how teams move fast without breaking things.
6οΈβ£ Best Practices for Stacked PRs β
β
Keep PRs small & logical
β
Merge regularly to avoid conflicts
β
Automate CI checks on each PR
β
Use a tool to manage the stack efficiently
5οΈβ£ Stacked PRs Keep Your Main Branch Clean
πΉ Merge each PR independently
πΉ No more "feature branches lingering for weeks"
πΉ Keeps main always deployable
4οΈβ£ Stacked PRs Reduce Context Switching
Reviewing small, focused PRs is faster than debugging a 5k-line monster.
Developers spend less time rebasing & more time shipping π
3οΈβ£ How Stacked PRs Improve Velocity π
πΉ Parallel reviews β Get feedback early
πΉ Fewer merge conflicts β Merge quickly
πΉ Easier rollbacks β Revert only the bad part
πΉ Better code quality β Focused, reviewable diffs