Skip to content

Instantly share code, notes, and snippets.

@SukkaW
Created October 4, 2018 12:13
Show Gist options
  • Save SukkaW/0654afabd4ae793d82fd6d9b09d79be3 to your computer and use it in GitHub Desktop.
Save SukkaW/0654afabd4ae793d82fd6d9b09d79be3 to your computer and use it in GitHub Desktop.
在所有子目录中的 git repo 里执行 git pull 和 git gc
#!/bin/bash
find `pwd` -type d -name ".git" > git_dir.txt
sed -i "s/\/.git/\//g" git_dir.txt
while read LINE
do
echo $LINE
cd "$LINE"
git pull
git gc
done < git_dir.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment