Junior Version Control

What is git stash, and when would you use it? Follow:

git stash temporarily saves your uncommitted changes so you can work on something

else without committing unfinished work.

Example:

You’re fixing a login bug but suddenly need to switch branches to fix a production issue.

Instead of committing half-done code, you run:

git stash

git checkout main

Later, you can come back and reapply your stashed work.

More from Developer Essentials

All questions for this course