0
0
Gitdevops~15 mins

git stash to save changes - Mini Project: Build & Apply

Choose your learning style9 modes available
Using <code>git stash</code> to Save Changes
📖 Scenario: You are working on a project and have made some changes to files. Suddenly, you need to switch to another task without committing your current changes. You want to save your work temporarily without losing it.
🎯 Goal: Learn how to use git stash to save your current changes safely and then view the saved stash.
📋 What You'll Learn
Create a new file with some changes
Use git stash to save changes
List the saved stashes
💡 Why This Matters
🌍 Real World
Developers often need to pause work on one task and switch to another without committing incomplete changes. <code>git stash</code> helps save work safely.
💼 Career
Knowing how to use <code>git stash</code> is essential for managing work in progress and collaborating smoothly in software development teams.
Progress0 / 4 steps
1
Create a new file with changes
Create a new file called feature.txt and add the text New feature in progress to it. Then stage the file using git add feature.txt.
Git
Need a hint?

Use echo to write text to the file and git add to stage it.

2
Save changes using git stash
Use the command git stash to save your current staged changes temporarily.
Git
Need a hint?

Simply run git stash to save your changes.

3
List saved stashes
Use the command git stash list to see the list of saved stashes.
Git
Need a hint?

Run git stash list to view saved stashes.

4
Show the output of git stash list
Run git stash list and observe the output showing your saved stash.
Git
Need a hint?

The output should show a line starting with stash@{0}: indicating your saved changes.