As Ben pointed out, you may use git stash path/to/file path/to/other/file to stash specific files. Another handy tip is that git provides very detailed man pages for each sub-command! However, these pages are somewhat tricky to find if you don't know the secret: Use man git-<name-of-subcommand>!
So if you are struggling with making stash do what you want, you can run man git-stash in your terminal and bam all kinds of detailed information that makes my head spin.
My favorite of the git-stash flags is -p -u. Running git stash save -p -u will step-by-step walk you through each and every changed/new file in your repo and ask "Do you want to stash this?"
As Ben pointed out, you may use
git stash path/to/file path/to/other/fileto stash specific files. Another handy tip is that git provides very detailedmanpages for each sub-command! However, these pages are somewhat tricky to find if you don't know the secret: Useman git-<name-of-subcommand>!So if you are struggling with making stash do what you want, you can run
man git-stashin your terminal and bam all kinds of detailed information that makes my head spin.My favorite of the
git-stashflags is-p -u. Runninggit stash save -p -uwill step-by-step walk you through each and every changed/new file in your repo and ask "Do you want to stash this?"Cool, huh?
Yup. Cool 😎
What does
-p -uflag does?the
-pflag allows you to decide, change by change, what you want to stash. The-uflag says "Also, stash untracked files"They do appear to be incompatible sometimes though.