I've got a folder - 'Repos' - which contains the repos that I'm interested in. These have been cloned from bitbucket, but I guess github could be a source too.
Repos
- music-app
- elephant-site
- node-demo
Is there a git command that I can use which steps thru every folder in Repos and sees if there are new commits on the server, and the download the new stuff? And if there are new commits locally, then upload these.
Try this:
cd repos
find . -maxdepth 1 -type d -exec sh -c '(cd {} && git pull)' ';'
For Windows, this should do it for you via a Command Prompt:
cd c:\repos
for /d %a in (*.*) do cd c:\repos\%a && git pull
Once you go back to the GitHub client, you should see the updates.
gitfox is a tool to execute command on all subrepo
npm install gitfox -g
g pull
To maintain several repos, you can use git submodule.
Use git submodule add
to add a repo as a submodule and use git submodule foreach git pull
to update the repos.
This method is like you have a super project, with several git projects in it.
What I have is a scriptlet that does something like:
for d in *
cd $d
git pull
cd ..
(Yes, it has a few extra bells and whistles, in that I have a few hg
repos, and others I manage in git from SVN upstream.)
For Windows, I'm using below in .cmd file. It can easily be extended to do something more or something else:
for /d %%i in (*) do (
pushd "%%i"
git pull
popd
)