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 a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Top 10 Content Management Systems (CMS) Tools in 2026: Features, Pros, Cons & Comparison

Introduction A Content Management System (CMS) is an essential platform for creating, managing, and modifying content on a website without needing specialized technical knowledge. In 2026, a…

Read More

Top 10 Subscription Management Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction Subscription management software is designed to streamline and optimize the process of managing recurring billing, customer subscriptions, and related business operations. In 2026, with the rapid…

Read More

Top 10 AI Data Integration Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI data integration tools are pivotal for businesses navigating the complexities of modern data ecosystems. These tools combine artificial intelligence with data integration processes…

Read More

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

Introduction In 2026, the logistics and transportation industries are evolving rapidly, and managing a fleet of vehicles has never been more complex. Fleet management software has become…

Read More

Top 10 AI Academic Plagiarism Checkers Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI academic plagiarism checkers have become indispensable tools for students, educators, researchers, and institutions striving to uphold academic integrity. With the rise of AI-generated…

Read More

Top 10 Travel Management Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, travel management software (TMS) has become a crucial tool for businesses, travel agencies, and frequent travelers. These tools automate the booking, tracking, and management…

Read More
Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Jason Mitchell
Jason Mitchell
1 month 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