1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00
Files
til/git/interactively-checkout-specific-files-from-a-stash.md

19 lines
649 B
Markdown

# Interactively Checkout Specific Files From A Stash
This command will prompt you with a list of the stashes in your current git
repo. Once you select one of them from the interactive fzf prompt, you will
then be prompted with another fzf prompt, this second one allow multi-select.
From there you can tab select the files you want to checkout. Once you've
marked the ones you want, hit enter and those files will be checked out to your
index.
```bash
git stash show --name-only $(
git stash list \
| fzf --height=20% --reverse \
| sed 's/:.*//'
) \
| fzf --height=20% --multi --sync \
| xargs -I {} sh -c 'git checkout stash@{0} -- {}'
```