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.
Combining two git repositories. Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things: preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location.
you can use git fetch to update the objects in your local clone, and then you can git checkout those particular files. This will update the file in your working directory and add it to the index ready to be committed on your local branch.
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.
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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With