There are situations in
which you have a work in progress code, which cannot be committed, but you want
to work on some other branch for an emergency issue. For example you want to
park the work in progress change in your development branch and work on an
emergency issue in the production branch, Git helps us achieve this using the
Stash option.
When you Stash changes in
the working / staging area the changes are stored in a separate copy and the
working copy is rolled back to the previous un-modified state. Stashing can be
done as follows.
1.
Opens the Source Tree application
2.
Select the Stash option from the toolbar.
3.
A pop-up appears, enter a name (label) for
the stash and click ok.
4.
Once the stashing is done, the un-committed
changes are removed from the working folder and stored as a separate copy; the
working folder is restored back to the previous commit state.
5. A new option ‘Stashes’ is
added to the left side tree, which provides the list of stashed.
6.
As you can see, we can apply (copy) the
changes from the stash to the working folder at a later point in time by
selecting the stash and selecting the ‘Apply Stach: . . .’ option
7. We can also discard
(delete) the changes stored in the copy of the stash by selecting the ‘Delete
Stach . . .’ option.
No comments:
Post a Comment