How to stash one file?
git stash push file_name
To stash only one of the changed files use git stash push path/to/file
.
git status
On branch main
Changes not staged for commit:
(use "git add/rm..." to update what will be committed)
(use "git restore..." to discard changes in working directory)
modified: code.rb
deleted: image.png
no changes added to commit (use "git add" and/or "git commit -a")
git stash push code.rb
Saved working directory and index state WIP on main: c335861 Changes in code and README
See git stash to learn more about it.