Git Stash Operation - Git (software)

What is Git Stash Operation?

Suppose you're implementing a new feature in your product. Your code is in development and suddenly a customer escalation comes. because of this, you have to preserve apart your new feature work for some hours. You cannot commit your partial code and also can not throw away your changes. so that you need a few temporary area, where you can save your partial changes and in a while commit it.

In Git, the stash operation takes your changed tracked files, levels adjustments, and saves them on a stack of unfinished adjustments that you may reapply at any time.

Now, you want to replace branches for consumer escalation, however you don’t want to commit what you’ve been working on yet; so that you’ll stash the adjustments. To push a new stash onto your stack, run the git stash command.

Now, your working directory is clean and all the changes are saved on a stack. Let us verify it with the git status command.

Now you may properly switch the branch and work elsewhere. we will view a list of stashed adjustments by way of using the git stash list command.

Suppose you have resolved the customer escalation and you are returned on your new feature looking for your half-done code, just execute the git stash pop command, to do away with the adjustments from the stack and region them in the present day working directory.

The above command will produce the following result:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Git (software) Topics