* This page is part of the open-source Flyte v2 docs.
* Full index: https://www.union.ai/docs/v2/flyte/llms.txt
* Flyte is the open-source project. Union.ai is a commercial superset of it and uses the same `flyte` SDK and CLI, so the Union.ai docs cover everything here and more.
* If a question is not answered in these docs, or is about a feature that may be commercial, check the Union.ai v2 docs at https://www.union.ai/docs/v2/union/llms.txt
* These are the v2 docs. v1 is out of date and deprecated. Only refer to v1 docs if asked explicitly about v1. The v1 index is at https://www.union.ai/docs/v1/flyte/llms.txt

A class representing the status of a git repository.

# GitStatus

**Package:** `flyte.git`

A class representing the status of a git repository.

## Parameters

```python
class GitStatus(
    is_valid: bool = False,
    is_tree_clean: bool = False,
    remote_url: str = '',
    repo_dir: pathlib.Path = PosixPath('.'),
    commit_sha: str = '',
)
```
| Parameter | Type | Description |
|-|-|-|
| `is_valid` | `bool` | Whether git repository is valid |
| `is_tree_clean` | `bool` | Whether working tree is clean |
| `remote_url` | `str` | Remote URL in HTTPS format |
| `repo_dir` | `pathlib.Path` | Repository root directory |
| `commit_sha` | `str` | Current commit SHA |

## Methods

| Method | Description |
|-|-|
| [`build_url()`](#build_url) | Build a git URL for the given path. |
| [`from_current_repo()`](#from_current_repo) | Discover git information from the current repository. |

### build_url()

```python
def build_url(
    path: pathlib.Path | str,
    line_number: int,
) -> str
```
Build a git URL for the given path.

| Parameter | Type | Description |
|-|-|-|
| `path` | `pathlib.Path \| str` | Path to a file |
| `line_number` | `int` | Line number of the code file |

**Returns:** Path relative to repo_dir

### from_current_repo()

```python
def from_current_repo()
```
Discover git information from the current repository.

If Git is not installed or .git does not exist, returns GitStatus with is_valid=False.

**Returns:** GitStatus instance with discovered git information

---
**Source**: https://github.com/unionai/unionai-docs/blob/main/content/api-reference/flyte-sdk/flyte.git/gitstatus.md
**HTML**: https://www.union.ai/docs/v2/flyte/api-reference/flyte-sdk/flyte.git/gitstatus/
