Normally, the way Git works by committing the changes you’ve made to your local repository after testing them carefully. Unfortunately, work doesn’t always happen in such a linear fashion. In some circumstances, you may be working on a site, but then need to move to another branch before you could complete the function from the first branch. In this case, committing to your changes would not be the right decision at this time because as unfinished changes would be added prematurely. This runs the risk of making things a little messy. The solution is Git stash. The command saves your started changes and restores them for you later.
This includes all changes that you have not committed to yet. If you then want to go back to those files, simply retrieve them from the git stash and finish the changes at your leisure. This way you don’t lose progress because you can save your work, and at the same time have the freedom to flexibly continue working on other things. Without Git stash, you would either get an error message on a Git Checkout or even lose the important changes you’ve made.