public function collectFromGit()
    {
        // Initial git data
        $git = new Collection();

        $gitDirectory = $this->getDirectory().DIRECTORY_SEPARATOR.self::GIT_DIRECTORY;

        if (is_dir($gitDirectory)) {
            // Get refs info from HEAD
            $branch = '';
            $head = Yaml::parse($gitDirectory.DIRECTORY_SEPARATOR.self::GIT_HEAD);

            // @codeCoverageIgnoreStart
            if (is_array($head) && array_key_exists('ref', $head)) {
                $ref = $head['ref'];
                $r = explode('/', $ref);
                $branch = array_pop($r);
            } 
            // @codeCoverageIgnoreEnd

            // Assign branch information
            $git->set('branch', $branch);

            // Get log information
            $logRaw = self::execute('cd '.$this->getDirectory().';git log -1');
            $idRaw = $logRaw[0];
            $authorRaw = $logRaw[1];

            // Build head information
            if (strpos($authorRaw, '<') !== false) {
                 list($author, $email) = explode('<', str_replace('Author:', '', $authorRaw));

                $id = trim(str_replace('commit', '', $idRaw));
                $author_name = $committer_name = trim($author);
                $author_email = $committer_email = trim($email, '>');
                $message = $logRaw[4].(isset($logRaw[5]) ? '...' : '');
            }
           

            // Assign Head information
            $git->set('head', compact('id', 'author_name', 'author_email', 
                            'committer_name', 'committer_email', 'message'));

            // Get remotes information
            $remotes = array();
            $configRaw = self::execute('cd '.$this->getDirectory().';git config --local -l');
            array_walk($configRaw,function($v) use(&$remotes)
            {
                if (0 === strpos($v, 'remote')) {
                    list($key, $prop) = explode('=', $v);
                    $k = explode('.', $key);
                    $attribute = array_pop($k);
                    $name = array_pop($k);
                    $remotes[$name]['name'] = $name;
                    $remotes[$name][$attribute] = $prop;
                }
            });

            // Assign Remotes information
            $git->set('remotes', array_values($remotes));
        }

        return $git;
    }