I am working with 5 repos that I have cloned in my development environment. When I want to update a git repo, I enter the folder /home/adrian/repo1/ and do:
git checkout
First, I recommend against using git pull. Instead, create a safer git up
alias:
git config --global alias.up '!git remote update -p; git merge --ff-only @{u}'
See this answer for an explanation of git up
.
Then you can safely script it:
#!/bin/sh
for repo in repo1 repo2 repo3 repo4; do
(cd "${repo}" && git checkout master && git up)
done