git stash some files code example

Example 1: view git stash without applying

git stash show -p stash@{1}

Example 2: how to apply changes in a single file from stash

git checkout stash@{0} -- <filename>

Example 3: git stash file

# git stash specific file
git stash push <path>

Example 4: how to apply changes in a single file from stash

git restore -s stash@{0} -- <filename>

Example 5: stash specific files

git stash push -m welcome_cart app/views/cart/welcome.thtml