Skip to content

Instantly share code, notes, and snippets.

@tkatochin
Created April 22, 2016 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkatochin/1245fcde97c164b5d384a1f2dcae892f to your computer and use it in GitHub Desktop.
Save tkatochin/1245fcde97c164b5d384a1f2dcae892f to your computer and use it in GitHub Desktop.
カレントディレクトリの直下のディレクトリから.gitを持つディレクトリをリストアップし、パラメータで渡したコマンドを各ディレクトリ内で実行する。
#!/bin/sh
for dir in `find . -maxdepth 1 -type d`; do
if [ -d $dir/.git ]; then
pushd . > /dev/null 2>&1
cd $dir
echo "======== ${dir##*/} ========"
$*
popd > /dev/null 2>&1
fi
done
@tkatochin
Copy link
Author

使い方の例

git-dir-all git branch -vv

とか

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment