Created
April 26, 2013 01:28
-
-
Save shibukawa/5464537 to your computer and use it in GitHub Desktop.
Defrag command for Mac OS/Linux
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/bash | |
# based on http://goingmyway.net/?p=632 | |
# | |
# check depend commands | |
# | |
_dependCommands="git expect" | |
for _COMMAND in ${_dependCommands}; do | |
if [ ! `whereis ${_COMMAND} |grep ${_COMMAND}` ]; then | |
echo "ERROR!! 必要なコマンドが見つかりません : ${_COMMAND}" | |
exit 1 | |
fi | |
done | |
# | |
# Get git dirs | |
# | |
_GITDIRS=`find . -name ".git" | sed "s/\(\.\/.*\)\/.git/\1/g"` | |
# | |
# Clean git dirs | |
# | |
for _DIRS in ${_GITDIRS}; do | |
echo -e "\n -- ${_DIRS} -- "; | |
cd $_DIRS; | |
git gc; | |
cd ../ | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment