git stash file code example

Example 1: git stas hauntracked files

git stash --include-untracked

Example 2: git stash example

git stash push -m "message" // use for code added in statsh 
git stash list // use for check stash list
git stash apply stash@{index}

Example 3: 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 4: how to apply changes in a single file from stash

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

Example 5: how to get stashed on git

git stash pop

Example 6: git stash file

# git stash specific file
git stash push <path>