I'd like to be able to stash just the changes from a single file:
git stash save -- just_my_file.txt
The above doesn't work though. Any alternatives?
2022-04-10
I'd like to be able to stash just the changes from a single file:
git stash save -- just_my_file.txt
The above doesn't work though. Any alternatives?
If you do not want to specify a message with your stashed changes, pass the filename after a double-dash.
$ git stash -- filename.ext
If it's an untracked/new file, you will have to stage it first.
However, if you do want to specify a message, use push
.
git stash push -m "describe changes to filename.ext" filename.ext
Both methods work in git versions 2.13+