git stash filename code example

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

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

Example 2: git stash apply specific file

git diff stash^! -- path/to/relevant/file/in/stash.ext perhaps/another/file.ext > my.patch
git apply < my.patch

Example 3: git stash file

# git stash specific file
git stash push <path>

Example 4: aad a single file to stash

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

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

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