How to use git stash?
As a developer, we realize that how much to do here and there during the
project work. So at a time, we need to do different things, and we seem to
get confused whether we want to do the final commit to the remote branch
or save the works to the local repository. So, it is convenient to save
your work in the local repository and come back later to finish the rest.
In this circumstance, git stash commands come very handily.
Two ways you can do this first; if you decide to stash your work at
first, you can do the git add command then do the git stash command that
will save your work in the local repository as in a small shelf unit.
Secondly, you could do the git stash command without the git add command;
then, in this case, you have to do the git stash -u (untracked files)
command that will save your work again in the local repository.
To view how many git stashes you have saved in your local directory, you
can make a git stash list command or git stash show.
Now you have decided to work on your old file; then you can bring it back
from the shelf to the local directory with the git stash pop or git stash
apply command.
If you decide to clear your stash, you can do either git stash clear that
will clear everything, or if you want to remove one by one that uses git
stash drop and name of the git stash. You can see a complete example
practically I how I did in this video.