Batch Git Pull:分享一个维护多个 Git 仓库的小脚本
October 29, 2019•253 words
不废话,放脚本:
find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull
更为方便的,直接将这部分加入你的 .zshrc 或者 .bash_profile:
alias gpall="find . -maxdepth 3 -name .git -type d | rev | cut -c 6- | rev | xargs -I {} git -C {} pull"
之后,直接执行 gpall 即可。
好了,我们进入正题。
维护多个 Git 仓库的需求
维护多个 Git 仓库不容易。我在我存放 GitHub 仓库的目录下运行了一下 tree:
.
├── AIP_BackEnd
├── Evaluation_BackEnd
| ... ...
├── SchoolProjects
│ ├── Distance-Vector-Algorithm
│ ├── cartoonize-images
| ... ...
│ ├── zanpress...
Read post