Reputation: 1269
I have multiple projects in a folder and I want to get latest.
For example:
C:\Projects\Project 1
C:\Projects\Project 2
C:\Projects\Project 3
Normally I would open up Git Bash, direct to one project (e.g. 'cd C:\Projects\Project 1
'), then type 'git pull
'.
After this, repeat on every other project.
Is there a quicker/shorter/less time consuming way to get latest on all of my projects?
Upvotes: 2
Views: 321
Reputation: 54467
If the submodule approach does not work for you, you could use a simple script written in Bash:
#!/bin/bash
for dir in */
do
echo "Updating $dir"
cd "$dir"
git pull
cd ..
done
If you define it as a function, you can even make it reusable for other commands:
function for_all_dirs ()
{
for dir in */
do
echo "Updating $dir"
cd "$dir"
$*
cd ..
done
}
Call this with for_all_dirs git pull
and it will pull in all of the directories.
Upvotes: 2
Reputation: 1326942
Another approach is to declare each of your repos in a parent project repo, as submodules.
You can configure those submodules to follow their respective master branch
cd c:\Projects\Parent
git submodule add -b master Project1 /url/Project1
That way, from the parent repo c:\Projects\Parent, a simple cmmand would update every submodule at once:
git submodule update --remote
Upvotes: 1