is a powerful version control system for keeping track of changes in codebases. It is really helpful when working in large teams, where things get really messy. Anyway, I was working on a piece of functionality the other day on a feature branch, and for some reason, I had to drop what I was doing and switch to a hotfix branch. It was quite urgent but I had already started work on the other branch and when I tried to switch, I got an error that I had some files that needed to be sorted before doing so. One option was to commit the files and add a comment stating that it was work in progress or use Git, to stash the changes: git stash
. This command will save the changes and shelve them for later use. Quite handy. Now to un-stash the changes all you have to do is the following: git stash apply.
Now Git will apply the latest stashed changes. If you have more than one you can specify which one to apply like so: git stash apply --index.
Next, you can list the shelved changes like so: git stash list.
I hope that is useful. For more information, visit https://git-scm.com/book/en/v2/Git-Tools-Stashing-and-Cleaning