class Git def self.branch begin `git branch`.scan(/\* ([.\w-]+)/)[0][0] rescue '' end end def self.remote_origin directory='' url='' directory=Dir.pwd if directory.length == 0 Dir.chdir(directory) do begin url=`git remote show origin`.scan(/Fetch URL: ([\.\-:\/\w\d]+)/)[0] rescue url='' end end url end end