mirror of
https://github.com/junegunn/fzf.git
synced 2025-11-18 08:13:40 -05:00
Updated Examples (markdown)
28
Examples.md
28
Examples.md
@@ -258,6 +258,34 @@ fcs() {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# fstash - easier way to deal with stashes
|
||||||
|
# type fstash to get a list of your stashes
|
||||||
|
# enter shows you the contents of the stash
|
||||||
|
# ctrl-d shows a diff of the stash against your current HEAD
|
||||||
|
# ctrl-b checks the stash out as a branch, for easier merging
|
||||||
|
fstash() {
|
||||||
|
local out q k sha
|
||||||
|
while out=$(
|
||||||
|
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" |
|
||||||
|
fzf --ansi --no-sort --query="$q" --print-query \
|
||||||
|
--expect=ctrl-d,ctrl-b);
|
||||||
|
do
|
||||||
|
q=$(head -1 <<< "$out")
|
||||||
|
k=$(head -2 <<< "$out" | tail -1)
|
||||||
|
sha=$(tail -1 <<< "$out" | cut -d' ' -f1)
|
||||||
|
[ -z "$sha" ] && continue
|
||||||
|
if [ "$k" = 'ctrl-d' ]; then
|
||||||
|
git diff $sha
|
||||||
|
elif [ "$k" = 'ctrl-b' ]; then
|
||||||
|
git stash branch "stash-$sha" $sha
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
git stash show -p $sha
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
```
|
||||||
### Tags
|
### Tags
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
Reference in New Issue
Block a user