ProgrammingLanguages:Bash

From fritz'wiki
Jump to: navigation, search

prunge.sh

하위 디렉토리에 동일한 명령어를 실행하기 위함

#!/bin/sh

CWD=`pwd`
for i in `find . -maxdepth 1 -type d`; do
    cd $i
    git remote prune origin
    cd $CWD
done

remove_old_git_tag.sh

3일 경과한 tag 삭제

#!/bin/sh
cd /workspace/gitrepo
platform='unknown'
unamestr=`uname`

if [[ $unamestr == 'Linux' ]]; then
  platform='linux'
  mindate=$(date -d "3 days ago" "+%Y%m%d%H%M%S");
elif [[ $unamestr == 'Darwin' ]]; then
  platform='osx'
  mindate=$(date -v-3d +%Y%m%d%H%M%S);
fi

for t in `git tag`
do
  if [[ $t =~  .*\.[0-9]{14} ]]
  then
    tag_name=( ${t//./ } )
    if [ ${tag_name[1]} -lt ${mindate} ]
    then
      git tag -d ${t}
      git push origin :tags/${t}
    fi
  fi
done
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox