Sometimes it happens to me that I am working on a branch of my repository and I have made significant changes to a file. I'm not ready to commit yet, but I want to switch branches to see something else.
What I do many times is git stash -u
to "stash" all the uncommitted files. However, there are times when I just want to "stash" a specific file, but I don't know how.
I have tried with:
git stash <fichero>
git stash -u <fichero>
But none of the options worked for me, in both it gives me the following error that lists all the options of the command:
usage: git stash list [<options>]
or: git stash show [<options>] [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git stash branch <branchname> [<stash>]
or: git stash clear
or: git stash [push [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [-m|--message <message>]
[--] [<pathspec>...]]
or: git stash save [-p|--patch] [-k|--[no-]keep-index] [-q|--quiet]
[-u|--include-untracked] [-a|--all] [<message>]
Is there any way to do it?