Last active
June 22, 2021 18:05
-
-
Save juancampa/69b065c5c09a775ea72f6c8c77960554 to your computer and use it in GitHub Desktop.
Iterate over all stash items
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stashit () | |
{ | |
for i in `seq 0 20`; | |
do | |
echo Changed files:; | |
git stash show stash@{$i}; | |
echo Untracked files:; | |
git diff --summary stash@{$i}^2; | |
echo; | |
while true; do | |
printf "stash@{$i} [A]pply/[D]iff/[Q]uit (leave blank to continue): " | |
read action; | |
case $action in | |
a | A) | |
git stash apply stash@{$i}; | |
break | |
;; | |
q | Q) | |
echo Quitting; | |
break | |
;; | |
d | D) | |
git stash show -p stash@{$i} | |
;; | |
*) | |
;; | |
esac; | |
if [[ $action != "d" ]]; then | |
break; | |
fi; | |
done; | |
if [[ -n "$action" ]]; then | |
break; | |
fi; | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment