1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-12 03:28:02 +00:00

Add Pick Specific Changes To Stash as a git til

This commit is contained in:
jbranchaud
2021-01-09 15:11:43 -06:00
parent ba1cc59cba
commit 51c3738c8c
2 changed files with 24 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
# Pick Specific Changes To Stash
If you run `git stash`, all of the changes to tracked files on the working tree
will be put into a commit-like entity in the stash list.
If you want to be a bit choosier about what gets saved during a stash, you can
include the `--patch` flag.
> With --patch, you can interactively select hunks from the diff between HEAD
> and the working tree to be stashed.
```bash
$ git stash --patch
```
Once in the interactive mode initiated by `--patch`, you'll be presented with a
change of changes and some options. You hit `y` for "yes, include this" and `n`
for "no, don't include that". And then there are some more advanced options
which you can read about in the _Interactive Mode_ section of `git-add`'s man
page.
See `man git-stash` for more details.