Tim Dysinger RSS

Jun
7th
Sat
permalink

Keeping your git projects up to date with sake

I have been keeping all my projects in git repositories regardless if they came from git or svn. I probably have about 3 dozen projects at any one time in my ~/Projects dir. Keeping them all up to date is a PITA. So I wrote a little sake task to find them all and update them. Here it is:
desc "Recursively update your git projects"
task "git:update" do
  `find . -name .git -type d`.each do prj
    Dir.chdir(File.dirname(prj)) do d
      puts(d)
     `git config --get svn-remote.svn.url`.empty? ?
     `git remote update` : `git svn fetch`
    end
  end
end