Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

โ€œInvest in yourself โ€” your confidence is always worth it.โ€

Explore Cosmetic Hospitals

Start your journey today โ€” compare options in one place.

Git Lab Exercise & Assignment: Git Stash: Part – 11

Often, when youโ€™ve been working on part of your project, things are in a messy state and you want to switch branches for a bit to work on something else. The problem is, you donโ€™t want to do a commit of half-done work just so you can get back to this point later. The answer to this issue is the git stash command.

You can also put it somthing like this, Your code is in progress and suddenly a customer escalation comes. Because of this, you have to keep aside your new feature work for a few hours. You cannot commit your partial code and also cannot throw away your changes. So you need some temporary space, where you can store your partial changes and later on commit it.

Stashing takes the dirty state of your working directory โ€“ that is, your modified tracked files and staged changes โ€“ and saves it on a stack of unfinished changes that you can reapply at any time.



# Modify | Add  Some files in Git working directory
$ git status
Now you want to switch branches, but you donโ€™t want to commit what youโ€™ve been working on yet; so youโ€™ll stash the changes. To push a new stash onto your stack, run git stash or git stash save:


$ git stash
Your working directory is clean:


$ git status
At this point, you can easily switch branches and do work elsewhere; your changes are stored on your stack. To see which stashes youโ€™ve stored, you can use git stash list:


$ git stash list
stash@{0}: WIP on master: 049d078 added the index file
stash@{1}: WIP on master: c264051 Revert "added file_size"
stash@{2}: WIP on master: 21d80a5 added number to log
If you want to apply one of the older stashes, you can specify it by naming it, like this: git stash apply stash@{2}.


$git stash apply stash@{2}
If you donโ€™t specify a stash, Git assumes the most recent stash and tries to apply it:


$ git stash applyCode language: PHP (php)

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

Top 10 IT Asset Management (ITAM) Tools in 2026: Features, Pros, Cons & Comparison

Introduction IT Asset Management (ITAM) is a critical discipline that focuses on managing an organization’s technology assets throughout their lifecycleโ€”from procurement to disposal. In 2026, with the…

Read More

Top 10 AI Essay Grading Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI essay grading tools have become indispensable for educators, students, and institutions looking to streamline the assessment process while maintaining high-quality feedback. These tools…

Read More

Top 10 AI Conversion Rate Optimization Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI-powered Conversion Rate Optimization (CRO) tools are transforming digital marketing by leveraging machine learning, predictive analytics, and real-time personalization to boost conversions. These tools…

Read More

Top 10 Integration Platform as a Service (iPaaS) Tools in 2026: Features, Pros, Cons & Comparison

Introduction In todayโ€™s fast-paced digital world, businesses are leveraging multiple software applications, cloud services, and data sources to streamline operations. However, the challenge lies in integrating these…

Read More

IReviewed Blog’s Post List

truereviewnow.com is a portal for product review and rating. truereviewnow.com is having very in-depth analysis of review and testimony of Mobiles, Laptop, Electronics Gadgets, Airports, Boradbands, Movies…

Read More

Top 10 Social Media Management Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, social media continues to be a cornerstone of digital marketing strategies, shaping how businesses connect with their audiences. With millions of users interacting on…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
4 months ago

Good hands-on explanation of git stash and how it helps save uncommitted work temporarily. One practical thing worth adding is that in real team workflows, stashes can quickly become a โ€œhidden state problemโ€ if overusedโ€”people forget what they stored or apply it on the wrong branch later. In CI/CD or collaborative environments, itโ€™s usually safer to prefer short-lived feature branches over long stash chains, since stashes donโ€™t get reviewed, tracked, or protected like commits do.

1
0
Would love your thoughts, please comment.x
()
x