šŸŽ“
1 / 16

103 — Git Stash: Saving Work in Progress

Learn to temporarily save uncommitted changes so you can switch contexts without losing work. Master the essential git stash workflow for managing work-in-progress.

Learning Objectives

1
Understand when and why to use git stash
2
Save uncommitted work temporarily
3
List, apply, and manage multiple stashes
4
Use named stashes for better organization
Step 1

Create a practice repository

Set up a repository to simulate the common stash workflow scenario.

Commands to Run

mkdir -p ~/git-practice/lesson-103
cd ~/git-practice/lesson-103
git init
echo "# Stash Practice" > README.md
git add README.md
git commit -m "Initial commit"
git checkout -b feature-login
echo "Login form code here" > login.html
git add login.html
git commit -m "Add login form"

What This Does

We're creating a realistic scenario where you're working on a feature branch. This mirrors real development where you often need to switch context mid-work.

Expected Outcome

You have a repository with a main branch and a feature-login branch with one commit.

Pro Tips

  • 1
    Run git branch to verify you're on feature-login

All Steps (0 / 16 completed)