Skip to content

Instantly share code, notes, and snippets.

@sohgoh
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save sohgoh/5e42b2d0ddc43a5f2705 to your computer and use it in GitHub Desktop.

Select an option

Save sohgoh/5e42b2d0ddc43a5f2705 to your computer and use it in GitHub Desktop.
git stash dropをまとめて実行するスクリプト
#!/bin/sh
# git stash dropを一気に実行するシェルスクリプト
# 直近の10stash($min)分まで一気にdropします
# 事前にcurrent環境変数には対象リポジトリのディレクトリパスを指定しておく
pushd $current
tmp=`git stash list | wc -l`
max=`expr $tmp - 1`
min=10
range=`expr $max - $min - 1`
for i in `seq 0 $range`
do
c=`expr $max - $i`
echo "git stash drop stash@{$c}"
git stash drop stash@{$c}
done
pwd
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment