mirror of
https://github.com/jbranchaud/til
synced 2026-01-05 08:08:02 +00:00
Add Interactively Checkout Specific Files From A Stash as a Git TIL
This commit is contained in:
18
git/interactively-checkout-specific-files-from-a-stash.md
Normal file
18
git/interactively-checkout-specific-files-from-a-stash.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# 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} -- {}'
|
||||
```
|
||||
Reference in New Issue
Block a user