Skip to content

Instantly share code, notes, and snippets.

@juancampa
Last active June 22, 2021 18:05
Show Gist options
  • Save juancampa/69b065c5c09a775ea72f6c8c77960554 to your computer and use it in GitHub Desktop.
Save juancampa/69b065c5c09a775ea72f6c8c77960554 to your computer and use it in GitHub Desktop.
Iterate over all stash items
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