13 Stashing (git stash)
There are times when you may want to stash (set aside) your current work rather than commit.
Examples:
- Realized that you were working on the wrong branch
- Realized that you and your collaborator are working on the same lines and resolving conflicts may be difficult
- Need to immediately switch to another branch and do not want to commit the change
- Partial commit
## * master
## On branch master
## Changes to be committed:
## (use "git restore --staged <file>..." to unstage)
## new file: temp_script.sh
##
## Untracked files:
## (use "git add <file>..." to include in what will be committed)
## .gitignore
13.1 Stash
## Saved working directory and index state WIP on master: 79dbfcb Adding loss.txt while in detached HEAD
## stash@{0}: WIP on master: 79dbfcb Adding loss.txt while in detached HEAD
13.2 Unstash
## On branch master
## Changes to be committed:
## (use "git restore --staged <file>..." to unstage)
## new file: temp_script.sh
##
## Untracked files:
## (use "git add <file>..." to include in what will be committed)
## .gitignore
##
## stash@{0}: WIP on master: 79dbfcb Adding loss.txt while in detached HEAD