Last active
August 29, 2015 14:24
-
-
Save sohgoh/5e42b2d0ddc43a5f2705 to your computer and use it in GitHub Desktop.
git stash dropをまとめて実行するスクリプト
This file contains hidden or 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
| #!/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