
It allows you to save changes that you might need at a later stage and is the fastest way to get your working directory clean while keeping changes intact. It's handy when you need to switch between contexts. git directory /.git/refs/stash, to be precise) and allows you to retrieve the changes when you need them. Git stash stores the changes you made to the working directory locally (inside your project's.

GITHUB DESKTOP STASH PATCH
The first method, although appearing conventional, is less flexible because the unfinished saved changes are treated as a checkpoint rather than a patch that's still a work in progress. Manually keep the changes in files not tracked by Git.Create a commit at that point in branch A, commit and push your changes to fix the bug in B, then check out A again and run git reset HEAD^ to get your changes back. The modifications stashed away by this command can be listed with git stash list, inspected with git stash show, and restored (potentially on top of a different commit) with git stash apply.Calling git stash without any arguments is equivalent to git stash push.There are few ways to enable branch switching in this case: Git immediately aborts the operation and throws the error, "Your local changes to the following files would be overwritten by checkout … Please commit your changes or stash them before you switch branches." You can search for and clone a repository from GitHub using the Git: Clone command in the Command Palette (Ctrl+Shift+P) or by using the Clone Repository button.

You quickly save your changes to A and try to check out branch B with git checkout B.

While working on some files in branch A, your team asks you to fix a bug in branch B. The A and B branches have diverged from each other for quite some time and have different heads. Suppose you are working on a repository with two branches, A and B. Assume for a moment that Git doesn't have a command to stash changes. The first thing to understand is why stashing changes in Git is important.
