I keep all the documents, code and whatnot for DGTL in several git repositories and synchronise those to secret remote locations (cool ey.) But its a hassle to update them all and why keep manually doing mundane tasks when you can replace it with a small (recursive) bash script 🙂
So I did.
The script loops through all maps and checks for the telltale .git folder. It its there, it runs the wonderful “git add . && git commit -a && git push“. This is probably not ideal, but its how I prefer it.
If there is no .git folder, it checks for an executable file with the same name, ie a copy of itself, though it doesnt check the content. A diff or md5 check or check for symlink might do this, but I trust myself to not screw this up. The script then runs that file. There is a risk for recursive hell here with symlinks to directories, but I’ll just not do that and it ll all be ok 🙂
The code is at http://www.gertschepens.be/bash#UpdateGit
So I put a symlink to the update script in ~/Documents/ and run it there. I put a second symlink in ~/Documents/Projects/. Effectively synchronising all the projects; hooray!
A simple script that works 🙂