For my latest venture I decided to split up parts of the codebase into separate git repositories. In the past I haven't done this and I just wanted to try something completely different in terms of code organization. So far it's been great ... alas nothing is perfect and there's one nasty side effect. My problem is sometimes I do a ton of work on my workstation at home and sometimes I'm mobile and moving from coffee shop to coffee shop. This seems like a semi-common use case (the assumption is that most developers have more than one machine they code on).
The problem is I'll do a major block of work on my workstation, commit, then push out to the server. I'll then get to where I'm going, and immediately pull down the latest to the laptop. Doing that with one repository is simple. Doing it with more than one repository ... lame and insanely repetitive. An engineer when seeing this pattern should automate.
#!/bin/bash START_HERE="/path/to/project/directory/"; cd $START_HERE; echo -e "\nPulling down latest for $START_HERE\n"; for d in $(find . -maxdepth 1 -mindepth 1 -type d); do echo -e "$d"; cd $d; git remote -v; git pull; cd $START_HERE; done echo -e "\nYou're welcome.\n";
Copy and paste this code into a file and
chmod 755 some_script_name.sh then