Skip to content

Instantly share code, notes, and snippets.

@mstssk
Created July 24, 2018 08:49
Show Gist options
  • Save mstssk/bdbd38b389a532172e7de82cd79e200f to your computer and use it in GitHub Desktop.
Save mstssk/bdbd38b389a532172e7de82cd79e200f to your computer and use it in GitHub Desktop.
古いgitブランチを探すシェルスクリプト
#!sh -eu
threshold=$1
threshold=$(echo $threshold | sed -e s/-//g) # 2018-06-28 -> 20180628
for b in $(git branch -r | grep -v HEAD);
do
date=$(git show --date=short --pretty=format:"%ad" $b | head -1 | sed -e s/-//g)
if [ $date -lt $threshold ]; then
echo $b $date
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment