Git Stash for Tracked vs Untracked Files (git stash vs git stash -u) | Hands-On Demo | + MCQs

Опубликовано: 21 Май 2026
на канале: Sachin Walia
13
3

Tracked vs Untracked Files | git stash vs git stash -u (Hands-On Demo)

In this hands-on Git tutorial, I dive deep into one of the most misunderstood Git commands — git stash — with a clear focus on tracked and untracked files.

This lesson is perfect for beginners, college students, freshers, and anyone learning Git practically. We don’t just explain concepts — we demonstrate Git behavior step by step using real terminal output so you can see exactly what happens.
________________________________________
🔍 What You’ll Learn in This Video

✔ Difference between tracked and untracked files in Git
✔ How git stash works with tracked files only
✔ How git stash -u stashes both tracked and untracked files
✔ Why untracked files remain after normal git stash
✔ How to inspect stash contents using
• git stash show -p
• git stash show -p -u
✔ How to restore files using git stash apply
✔ Practical comparison of git stash vs git stash -u
________________________________________
🧪 Hands-On Lab Highlights

📌 Modify a tracked file and create a new untracked file
📌 Observe git status before and after stashing
📌 Apply stashes and verify restored files
📌 Understand why Git hides untracked files by default in stash previews
📌 Compare multiple stashes using git stash list

All commands are executed live, with expected outputs shown and explained, making this lesson ideal for self-learning and exam preparation.
________________________________________
🎯 Who Should Watch This?

✅ Git beginners
✅ Engineering & CS students
✅ Freshers preparing for interviews
✅ Developers confused about git stash behavior
✅ Anyone learning Git through hands-on practice
________________________________________
📘 Key Takeaway

👉 Use git stash when you only want to save changes to tracked files
👉 Use git stash -u when you also need to temporarily save untracked files
Understanding this distinction will save you from data loss, confusion, and broken workflows.
________________________________________

🔔 Subscribe for more practical Git, Linux, Networking, Python, and DevOps tutorials
👍 Like | 💬 Comment | 🔁 Share with your classmates and teammates
________________________________________

#git stash tutorial
#git stash vs git stash -u
#tracked vs untracked files git
#git stash apply
#git stash show -p
#git for beginners
#git hands on tutorial
#git interview questions
#git practical demo