static function fromJson(object $map): self {
    return new static(
      isset($map->head) && is_object($map->head) ? GitCommit::fromJson($map->head) : null,
      isset($map->branch) && is_string($map->branch) ? $map->branch : '',
      isset($map->remotes) && is_array($map->remotes) ? array_map([GitRemote::class, 'fromJson'], $map->remotes) : []
    );
  }